|
@@ -102,12 +102,13 @@ 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,
|
|
|
- @RequestParam(required = false) Long rootOrgId,
|
|
|
- @RequestParam(required = false) Long orgId,
|
|
|
- @RequestParam(required = false) BooleanSelect hasPhoto) {
|
|
|
+ public PageInfo<StudentDomain> getStudentPage(
|
|
|
+ @PathVariable Integer curPage,
|
|
|
+ @PathVariable Integer pageSize, @RequestParam String name,
|
|
|
+ @RequestParam String studentCode, @RequestParam String identityNumber,
|
|
|
+ @RequestParam(required = false) Long rootOrgId,
|
|
|
+ @RequestParam(required = false) Long orgId,
|
|
|
+ @RequestParam(required = false) BooleanSelect hasPhoto) {
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
|
if (null == rootOrgId) {
|
|
@@ -125,10 +126,10 @@ public class StudentController extends ControllerSupport {
|
|
|
if (StringUtils.isNotEmpty(name)) {
|
|
|
predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(identityNumber)) {
|
|
|
- predicates.add(
|
|
|
- cb.like(root.get("identityNumber"), toSqlSearchPattern(identityNumber)));
|
|
|
+ if (StringUtils.isNotBlank(identityNumber)) {
|
|
|
+ predicates.add(cb.like(root.get("identityNumber"), toSqlRightLike(identityNumber)));
|
|
|
}
|
|
|
+
|
|
|
if (null != hasPhoto) {
|
|
|
Boolean hasPhotoBoolean = hasPhoto.getBoolean();
|
|
|
if (null != hasPhotoBoolean) {
|
|
@@ -140,12 +141,12 @@ public class StudentController extends ControllerSupport {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(studentCode)) {
|
|
|
+ if (StringUtils.isNotBlank(studentCode)) {
|
|
|
Subquery<StudentCodeEntity> subquery = query.subquery(StudentCodeEntity.class);
|
|
|
Root<StudentCodeEntity> subRoot = subquery.from(StudentCodeEntity.class);
|
|
|
subquery.select(subRoot.get("id"));
|
|
|
Predicate p1 = cb.equal(subRoot.get("studentId"), root.get("id"));
|
|
|
- Predicate p2 = cb.like(subRoot.get("studentCode"), toSqlSearchPattern(studentCode));
|
|
|
+ Predicate p2 = cb.like(subRoot.get("studentCode"), toSqlRightLike(studentCode));
|
|
|
subquery.where(cb.and(p1, p2));
|
|
|
predicates.add(cb.exists(subquery));
|
|
|
}
|
|
@@ -246,13 +247,14 @@ public class StudentController extends ControllerSupport {
|
|
|
ret.setList(studentDomainList);
|
|
|
ret.setTotal(studentList.getTotalElements());
|
|
|
return ret;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "导出学生", notes = "")
|
|
|
@GetMapping("export")
|
|
|
- public void exportStudents(@RequestParam String name, @RequestParam String studentCode,
|
|
|
- @RequestParam String identityNumber, @RequestParam(required = false) Long rootOrgId,
|
|
|
+ public void exportStudents(@RequestParam String name,
|
|
|
+ @RequestParam String studentCode,
|
|
|
+ @RequestParam String identityNumber,
|
|
|
+ @RequestParam(required = false) Long rootOrgId,
|
|
|
@RequestParam(required = false) Long orgId,
|
|
|
@RequestParam(required = false) BooleanSelect hasPhoto) {
|
|
|
|
|
@@ -272,10 +274,10 @@ public class StudentController extends ControllerSupport {
|
|
|
if (StringUtils.isNotEmpty(name)) {
|
|
|
predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(identityNumber)) {
|
|
|
- predicates.add(
|
|
|
- cb.like(root.get("identityNumber"), toSqlSearchPattern(identityNumber)));
|
|
|
+ if (StringUtils.isNotBlank(identityNumber)) {
|
|
|
+ predicates.add(cb.like(root.get("identityNumber"), toSqlRightLike(identityNumber)));
|
|
|
}
|
|
|
+
|
|
|
if (null != hasPhoto) {
|
|
|
Boolean hasPhotoBoolean = hasPhoto.getBoolean();
|
|
|
if (null != hasPhotoBoolean) {
|
|
@@ -287,12 +289,12 @@ public class StudentController extends ControllerSupport {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(studentCode)) {
|
|
|
+ if (StringUtils.isNotBlank(studentCode)) {
|
|
|
Subquery<StudentCodeEntity> subquery = query.subquery(StudentCodeEntity.class);
|
|
|
Root<StudentCodeEntity> subRoot = subquery.from(StudentCodeEntity.class);
|
|
|
subquery.select(subRoot.get("id"));
|
|
|
Predicate p1 = cb.equal(subRoot.get("studentId"), root.get("id"));
|
|
|
- Predicate p2 = cb.like(subRoot.get("studentCode"), toSqlSearchPattern(studentCode));
|
|
|
+ Predicate p2 = cb.like(subRoot.get("studentCode"), toSqlRightLike(studentCode));
|
|
|
subquery.where(cb.and(p1, p2));
|
|
|
predicates.add(cb.exists(subquery));
|
|
|
}
|