|
@@ -114,6 +114,7 @@ public class StudentController extends ControllerSupport {
|
|
|
@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();
|
|
@@ -161,18 +162,32 @@ public class StudentController extends ControllerSupport {
|
|
|
accessUser.getRoleList(), OrgStudentData.CODE);
|
|
|
Boolean allStudentData = PrivilegeManager.judge(finalRootOrgId,
|
|
|
accessUser.getRoleList(), AllStudentData.CODE);
|
|
|
+
|
|
|
// 学习中心角色用户数据过滤
|
|
|
if (hasRole(RoleMeta.LC_USER)) {
|
|
|
- if ((!allStudentData) && orgStudentData) {
|
|
|
- UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
|
|
|
- UserEntity.class);
|
|
|
- Long orgId = user.getOrgId();
|
|
|
- predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ if (allStudentData) {
|
|
|
+ if (null != orgId) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ }
|
|
|
} else {
|
|
|
- predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ if (orgStudentData) {
|
|
|
+ UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
|
|
|
+ UserEntity.class);
|
|
|
+ if (null != user.getOrgId()) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), user.getOrgId()));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ }
|
|
|
}
|
|
|
} else if (!isSuperAdmin()) {
|
|
|
- if (!allStudentData) {
|
|
|
+ if (allStudentData) {
|
|
|
+ if (null != orgId) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
}
|
|
|
}
|
|
@@ -245,6 +260,7 @@ public class StudentController extends ControllerSupport {
|
|
|
@GetMapping("export")
|
|
|
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) {
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
@@ -292,18 +308,32 @@ public class StudentController extends ControllerSupport {
|
|
|
accessUser.getRoleList(), OrgStudentData.CODE);
|
|
|
Boolean allStudentData = PrivilegeManager.judge(finalRootOrgId,
|
|
|
accessUser.getRoleList(), AllStudentData.CODE);
|
|
|
+
|
|
|
// 学习中心角色用户数据过滤
|
|
|
if (hasRole(RoleMeta.LC_USER)) {
|
|
|
- if ((!allStudentData) && orgStudentData) {
|
|
|
- UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
|
|
|
- UserEntity.class);
|
|
|
- Long orgId = user.getOrgId();
|
|
|
- predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ if (allStudentData) {
|
|
|
+ if (null != orgId) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ }
|
|
|
} else {
|
|
|
- predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ if (orgStudentData) {
|
|
|
+ UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
|
|
|
+ UserEntity.class);
|
|
|
+ if (null != user.getOrgId()) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), user.getOrgId()));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
+ }
|
|
|
}
|
|
|
} else if (!isSuperAdmin()) {
|
|
|
- if (!allStudentData) {
|
|
|
+ if (allStudentData) {
|
|
|
+ if (null != orgId) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
predicates.add(cb.equal(root.get("orgId"), -1));
|
|
|
}
|
|
|
}
|