|
|
@ -53,7 +53,7 @@ public class UmsStudentManageServiceImpl extends ServiceImpl<UmsStudentManageMap |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, Object> pageQuery(UmsStudentPageQueryDTO umsStudentPageQueryDTO) { |
|
|
|
public Map<String, Object> pageQuery(UmsStudentPageQueryDTO umsStudentPageQueryDTO) { |
|
|
|
|
|
|
|
|
|
|
|
LinkedHashSet<UmsStudentManage> umsStudentManages = coursesService.queryTeacherByStudentList(umsStudentPageQueryDTO.getName()); |
|
|
|
LinkedHashSet<UmsStudentManage> umsStudentManages = coursesService.queryTeacherByStudentList(umsStudentPageQueryDTO.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
//总记录数
|
|
|
|
//总记录数
|
|
|
|
int totalCount = umsStudentManages.size(); |
|
|
|
int totalCount = umsStudentManages.size(); |
|
|
@ -61,16 +61,33 @@ public class UmsStudentManageServiceImpl extends ServiceImpl<UmsStudentManageMap |
|
|
|
//总页数
|
|
|
|
//总页数
|
|
|
|
int totalPages = (int) Math.ceil((double) totalCount / umsStudentPageQueryDTO.getPageSize()); |
|
|
|
int totalPages = (int) Math.ceil((double) totalCount / umsStudentPageQueryDTO.getPageSize()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("totalCount", totalCount); |
|
|
|
|
|
|
|
result.put("totalPages", totalPages); |
|
|
|
|
|
|
|
result.put("currentPage", umsStudentPageQueryDTO.getPage()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//对集合里的数据进行模糊和分页查询
|
|
|
|
|
|
|
|
if (umsStudentPageQueryDTO.getName() != null){ |
|
|
|
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() |
|
|
|
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() |
|
|
|
|
|
|
|
.filter(studentManage -> studentManage.getName().contains(umsStudentPageQueryDTO.getName())) |
|
|
|
.skip((umsStudentPageQueryDTO.getPage() - 1) * umsStudentPageQueryDTO.getPageSize()) |
|
|
|
.skip((umsStudentPageQueryDTO.getPage() - 1) * umsStudentPageQueryDTO.getPageSize()) |
|
|
|
.limit(umsStudentPageQueryDTO.getPageSize()) |
|
|
|
.limit(umsStudentPageQueryDTO.getPageSize()) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("Records", umsStudentManageList); |
|
|
|
result.put("Records", umsStudentManageList); |
|
|
|
result.put("totalCount", totalCount); |
|
|
|
}else if (umsStudentPageQueryDTO.getNumber() != null){ |
|
|
|
result.put("totalPages", totalPages); |
|
|
|
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() |
|
|
|
result.put("currentPage", umsStudentPageQueryDTO.getPage()); |
|
|
|
.filter(studentManage -> studentManage.getNumber().contains(umsStudentPageQueryDTO.getNumber())) |
|
|
|
|
|
|
|
.skip((umsStudentPageQueryDTO.getPage() - 1) * umsStudentPageQueryDTO.getPageSize()) |
|
|
|
|
|
|
|
.limit(umsStudentPageQueryDTO.getPageSize()) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
result.put("Records", umsStudentManageList); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() |
|
|
|
|
|
|
|
.skip((umsStudentPageQueryDTO.getPage() - 1) * umsStudentPageQueryDTO.getPageSize()) |
|
|
|
|
|
|
|
.limit(umsStudentPageQueryDTO.getPageSize()) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
result.put("Records", umsStudentManageList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|