wangwei преди 6 години
родител
ревизия
d57d9eb931

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

@@ -64,16 +64,25 @@ public class StudentController extends ControllerSupport {
 	 * @param pageSize
 	 * @return
 	 */
-	@ApiOperation(value = "查询所有学生", notes = "分页")
+	@ApiOperation(value = "查询学生分页数据", notes = "分页")
 	@GetMapping("studentPage/{curPage}/{pageSize}")
-	public Page<StudentEntity> getStudentPage(@RequestParam String name,
+	public Page<StudentEntity> getStudentPage(@PathVariable Integer curPage,
+			@PathVariable Integer pageSize, @RequestParam String name,
 			@RequestParam String studentCode, @RequestParam String identityNumber,
-			@PathVariable Integer curPage, @PathVariable Integer pageSize) {
+			@RequestParam(required = false) Long rootOrgId) {
+
 		User accessUser = getAccessUser();
+		if (null == rootOrgId) {
+			rootOrgId = accessUser.getRootOrgId();
+		}
+
+		validateRootOrgIsolation(rootOrgId);
+
+		final Long finalRootOrgId = rootOrgId;
 
 		Specification<StudentEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
-			predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
+			predicates.add(cb.equal(root.get("rootOrgId"), finalRootOrgId));
 
 			if (StringUtils.isNotEmpty(name)) {
 				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));