|
|
@@ -6,7 +6,9 @@ import com.auth0.jwt.interfaces.Claim;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.api.R;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.template.annotation.PassToken;
|
|
|
import com.template.api.WelcomeStudentControllerAPI;
|
|
|
import com.template.common.utils.ExcelUtils;
|
|
|
@@ -79,6 +81,9 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
private WelcomeBedService welcomeBedService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private WelcomeAccountService welcomeAccountService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private WelcomeSettingService welcomeSettingService;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -457,8 +462,25 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CommonResult queryPageStudents(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
|
|
|
- PageUtils<StudentPageVo> result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, collegeId, majorId, classstrId, trafficMethod, name);
|
|
|
+ public CommonResult queryPageStudents(String userId,int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
|
|
|
+ IPage<StudentPageVo> pages = new Page<>();
|
|
|
+ PageUtils<StudentPageVo> result =new PageUtils<>(pages);
|
|
|
+ WelcomeAccount wa = welcomeAccountService.getManageById(userId);
|
|
|
+ if (wa == null) {
|
|
|
+ return CommonResult.fail("当前账户已失效,无权限查看");
|
|
|
+ }
|
|
|
+ List<String> collegeIds = Arrays.asList(wa.getCollegeId().split(","));
|
|
|
+ if(collegeId != null && collegeId.intValue() > 0){
|
|
|
+ if (!collegeIds.contains(String.valueOf(collegeId))) {
|
|
|
+ pages.setCurrent(currentPage);
|
|
|
+ pages.setSize(pageCount);
|
|
|
+ return CommonResult.ok(result);
|
|
|
+ }else {
|
|
|
+ collegeIds = new ArrayList<>();
|
|
|
+ collegeIds.add(String.valueOf(collegeId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, collegeIds, majorId, classstrId, trafficMethod, name);
|
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
|
|
|
|
@@ -1426,11 +1448,27 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void welcomeStudentExport(HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
|
|
|
- List<StudentPageVo> result = welcomeStudentService.queryStudentList(collegeId, majorId, classstrId, trafficMethod, name);
|
|
|
- //导出
|
|
|
+ public void welcomeStudentExport(String userId,HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
Sheet sheet = workbook.createSheet("学生信息");
|
|
|
+ WelcomeAccount wa = welcomeAccountService.getManageById(userId);
|
|
|
+ if (wa == null) {
|
|
|
+ System.out.println("当前账户已失效,无权限查看");
|
|
|
+ ExcelUtils.excelDownload(workbook, "学生信息.xlsx", response);
|
|
|
+ }
|
|
|
+ List<String> collegeIds = Arrays.asList(wa.getCollegeId().split(","));
|
|
|
+ if(collegeId != null && collegeId.intValue() > 0){
|
|
|
+ if (!collegeIds.contains(String.valueOf(collegeId))) {
|
|
|
+
|
|
|
+ ExcelUtils.excelDownload(workbook, "学生信息.xlsx", response);
|
|
|
+ }else {
|
|
|
+ collegeIds = new ArrayList<>();
|
|
|
+ collegeIds.add(String.valueOf(collegeId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StudentPageVo> result = welcomeStudentService.queryStudentList(collegeIds, majorId, classstrId, trafficMethod, name);
|
|
|
+ //导出
|
|
|
|
|
|
Row headerRow = sheet.createRow(0);
|
|
|
headerRow.createCell(0).setCellValue("序号");
|