WANG 6 жил өмнө
parent
commit
33ffe3e386

+ 22 - 12
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java

@@ -79,8 +79,9 @@ public class StudentController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "查询学生分页数据", notes = "分页")
 	@GetMapping("studentPage/{curPage}/{pageSize}")
-	public PageInfo<StudentDomain> getStudentPage(@PathVariable Integer curPage, @PathVariable Integer pageSize,
-			@RequestParam String name, @RequestParam String studentCode, @RequestParam String identityNumber,
+	public PageInfo<StudentDomain> getStudentPage(@PathVariable Integer curPage,
+			@PathVariable Integer pageSize, @RequestParam String name,
+			@RequestParam String studentCode, @RequestParam String identityNumber,
 			@RequestParam(required = false) Long rootOrgId) {
 
 		User accessUser = getAccessUser();
@@ -103,12 +104,14 @@ public class StudentController extends ControllerSupport {
 				predicates.add(cb.like(root.get("studentCode"), toSqlSearchPattern(studentCode)));
 			}
 			if (StringUtils.isNotEmpty(identityNumber)) {
-				predicates.add(cb.like(root.get("identityNumber"), toSqlSearchPattern(identityNumber)));
+				predicates.add(
+						cb.like(root.get("identityNumber"), toSqlSearchPattern(identityNumber)));
 			}
 			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
 
-		PageRequest pageRequest = new PageRequest(curPage, pageSize, new Sort(Direction.DESC, "updateTime"));
+		PageRequest pageRequest = new PageRequest(curPage, pageSize,
+				new Sort(Direction.DESC, "updateTime"));
 
 		Page<StudentEntity> studentList = studentRepo.findAll(specification, pageRequest);
 
@@ -233,7 +236,8 @@ public class StudentController extends ControllerSupport {
 				throw new StatusException("B-450110", "学生不存在");
 			}
 			String identityNumber = s.getIdentityNumber();
-			if (StringUtils.isNotEmpty(identityNumber) && identityNumber.matches("[0-9a-zA-Z]{6,}")) {
+			if (StringUtils.isNotEmpty(identityNumber)
+					&& identityNumber.matches("[0-9a-zA-Z]{6,}")) {
 				s.setPassword(StringUtils.substring(identityNumber, -6, identityNumber.length()));
 			} else {
 				s.setPassword(BasicConsts.DEFAULT_PASSWORD);
@@ -291,19 +295,21 @@ public class StudentController extends ControllerSupport {
 		User accessUser = getAccessUser();
 		Long rootOrgId = accessUser.getRootOrgId();
 		Long studentId = accessUser.getUserId();
-		StudentInfo studentInfo = studentService.getStudentInfo(rootOrgId, studentId, null, null, null);
+		StudentInfo studentInfo = studentService.getStudentInfo(rootOrgId, studentId, null, null,
+				null);
 		return studentInfo;
 	}
 
 	@ApiOperation(value = "查询学生")
 	@GetMapping("getStudentInfo")
 	public StudentInfo getStudentInfo(@RequestParam(required = false) Long studentId,
-			@RequestParam(required = false) String identityNumber, @RequestParam(required = false) String studentCode,
+			@RequestParam(required = false) String identityNumber,
+			@RequestParam(required = false) String studentCode,
 			@RequestParam(required = false) String securityPhone) {
 		User accessUser = getAccessUser();
 		Long rootOrgId = accessUser.getRootOrgId();
-		StudentInfo studentInfo = studentService.getStudentInfo(rootOrgId, studentId, identityNumber, studentCode,
-				securityPhone);
+		StudentInfo studentInfo = studentService.getStudentInfo(rootOrgId, studentId,
+				identityNumber, studentCode, securityPhone);
 		return studentInfo;
 	}
 
@@ -350,8 +356,10 @@ public class StudentController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "解绑学号", notes = "")
-	@PutMapping("unbindStudentCodeByStudentCode")
-	public List<Long> unbindStudentCodeByStudentCode(@RequestParam(required = true) String studentCode,
+	@PutMapping("unbindStudentCode")
+	public List<Long> unbindStudentCodeByStudentCode(
+			@RequestParam(required = true) String studentCode,
+			@RequestParam(required = false) String identityNumber,
 			@RequestParam(required = true) Long rootOrgId) {
 
 		if (null == rootOrgId) {
@@ -368,7 +376,9 @@ public class StudentController extends ControllerSupport {
 			throw new StatusException("B-160002", "studentCode is blank");
 		}
 
-		List<Long> studentIdList = studentService.unbindStudentCode(rootOrgId, studentCode, null);
+		List<Long> studentIdList = studentService.unbindStudentCode(rootOrgId, studentCode,
+				identityNumber);
+
 		return studentIdList;
 	}