肖海南学生管理模糊分页修改

master
总裁 3 months ago
parent 53f7dc9bda
commit 2c6cea9aa3
  1. 2
      src/main/java/com/teaching/backend/controller/umsAdmin/UmsStudentManageController.java
  2. 5
      src/main/java/com/teaching/backend/service/impl/umsAdmin/UmsStudentManageServiceImpl.java

@ -1,6 +1,7 @@
package com.teaching.backend.controller.umsAdmin; package com.teaching.backend.controller.umsAdmin;
import com.teaching.backend.common.CommonResult; import com.teaching.backend.common.CommonResult;
import com.teaching.backend.filter.ValidateParams;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO; import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage; import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
import com.teaching.backend.service.umsAdmin.UmsStudentManageService; import com.teaching.backend.service.umsAdmin.UmsStudentManageService;
@ -28,6 +29,7 @@ public class UmsStudentManageController {
* @return * @return
*/ */
@GetMapping("/page") @GetMapping("/page")
@ValidateParams({"page","pageSize", "userId"}) // 需要校验的参数
@ApiOperation("学生管理分页查询") @ApiOperation("学生管理分页查询")
public CommonResult<Map<String, Object>> page(UmsStudentPageQueryDTO umsStudentPageQueryDTO){ public CommonResult<Map<String, Object>> page(UmsStudentPageQueryDTO umsStudentPageQueryDTO){
Map<String, Object> pageResult = umsStudentManageService.pageQuery(umsStudentPageQueryDTO); Map<String, Object> pageResult = umsStudentManageService.pageQuery(umsStudentPageQueryDTO);

@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
@ -67,7 +68,7 @@ public class UmsStudentManageServiceImpl extends ServiceImpl<UmsStudentManageMap
result.put("currentPage", umsStudentPageQueryDTO.getPage()); result.put("currentPage", umsStudentPageQueryDTO.getPage());
//对集合里的数据进行模糊和分页查询 //对集合里的数据进行模糊和分页查询
if (umsStudentPageQueryDTO.getName() != null){ if (StringUtils.hasText(umsStudentPageQueryDTO.getName())){
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream()
.filter(studentManage -> .filter(studentManage ->
studentManage != null && studentManage != null &&
@ -77,7 +78,7 @@ public class UmsStudentManageServiceImpl extends ServiceImpl<UmsStudentManageMap
.limit(umsStudentPageQueryDTO.getPageSize()) .limit(umsStudentPageQueryDTO.getPageSize())
.collect(Collectors.toList()); .collect(Collectors.toList());
result.put("Records", umsStudentManageList); result.put("Records", umsStudentManageList);
}else if (umsStudentPageQueryDTO.getNumber() != null){ }else if (StringUtils.hasText(umsStudentPageQueryDTO.getNumber())){
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream() List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream()
.filter(studentManage -> .filter(studentManage ->
studentManage != null && studentManage != null &&

Loading…
Cancel
Save