wangwei 5 gadi atpakaļ
vecāks
revīzija
b2da88c7df

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

@@ -163,14 +163,18 @@ public class StudentController extends ControllerSupport {
 			Boolean allStudentData = PrivilegeManager.judge(finalRootOrgId,
 					accessUser.getRoleList(), AllStudentData.CODE);
 
-			// 学习中心角色用户数据过滤
-			if (hasRole(RoleMeta.LC_USER)) {
-				if (allStudentData) {
-					if (null != orgId) {
-						predicates.add(cb.equal(root.get("orgId"), orgId));
-					}
-				} else {
-					if (orgStudentData) {
+			// 学习中心过滤
+			if (isSuperAdmin()) {
+				if (null != orgId) {
+					predicates.add(cb.equal(root.get("orgId"), orgId));
+				}
+			} else if (allStudentData) {
+				if (null != orgId) {
+					predicates.add(cb.equal(root.get("orgId"), orgId));
+				}
+			} else {
+				if (orgStudentData) {
+					if (hasRole(RoleMeta.LC_USER)) {
 						UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
 								UserEntity.class);
 						if (null != user.getOrgId()) {
@@ -181,12 +185,6 @@ public class StudentController extends ControllerSupport {
 					} else {
 						predicates.add(cb.equal(root.get("orgId"), -1));
 					}
-				}
-			} else if (!isSuperAdmin()) {
-				if (allStudentData) {
-					if (null != orgId) {
-						predicates.add(cb.equal(root.get("orgId"), orgId));
-					}
 				} else {
 					predicates.add(cb.equal(root.get("orgId"), -1));
 				}
@@ -309,14 +307,18 @@ public class StudentController extends ControllerSupport {
 			Boolean allStudentData = PrivilegeManager.judge(finalRootOrgId,
 					accessUser.getRoleList(), AllStudentData.CODE);
 
-			// 学习中心角色用户数据过滤
-			if (hasRole(RoleMeta.LC_USER)) {
-				if (allStudentData) {
-					if (null != orgId) {
-						predicates.add(cb.equal(root.get("orgId"), orgId));
-					}
-				} else {
-					if (orgStudentData) {
+			// 学习中心过滤
+			if (isSuperAdmin()) {
+				if (null != orgId) {
+					predicates.add(cb.equal(root.get("orgId"), orgId));
+				}
+			} else if (allStudentData) {
+				if (null != orgId) {
+					predicates.add(cb.equal(root.get("orgId"), orgId));
+				}
+			} else {
+				if (orgStudentData) {
+					if (hasRole(RoleMeta.LC_USER)) {
 						UserEntity user = GlobalHelper.getEntity(userRepo, accessUser.getUserId(),
 								UserEntity.class);
 						if (null != user.getOrgId()) {
@@ -327,12 +329,6 @@ public class StudentController extends ControllerSupport {
 					} else {
 						predicates.add(cb.equal(root.get("orgId"), -1));
 					}
-				}
-			} else if (!isSuperAdmin()) {
-				if (allStudentData) {
-					if (null != orgId) {
-						predicates.add(cb.equal(root.get("orgId"), orgId));
-					}
 				} else {
 					predicates.add(cb.equal(root.get("orgId"), -1));
 				}