wangwei 6 年之前
父节点
当前提交
4780f09560

+ 2 - 2
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -341,7 +341,7 @@ public class OrgController extends ControllerSupport {
 	@GetMapping("/logo")
 	public void getLogo(@RequestParam("domain") String domain, HttpServletResponse response)
 			throws IOException {
-		OrgEntity org = orgRepo.findRootOrg(domain);
+		OrgEntity org = orgRepo.findRootOrgByCode(domain);
 		DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
 		DynamicEnum de = manager.getByName("LOGO_PATH");
 
@@ -355,7 +355,7 @@ public class OrgController extends ControllerSupport {
 	@ApiOperation(value = "查询顶级机构")
 	@GetMapping("/getRootOrgByCode")
 	public OrgEntity getRootOrgByCode(@RequestParam("code") String code) throws IOException {
-		OrgEntity org = orgRepo.findRootOrg(code);
+		OrgEntity org = orgRepo.findRootOrgByCode(code);
 		return org;
 	}
 

+ 4 - 4
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgRepo.java

@@ -30,10 +30,10 @@ public interface OrgRepo
 
 	List<OrgEntity> findByParentIdAndEnable(Long parentId, Boolean enable);
 
-	@Query(value = "select from OrgEntity where parentId is null and code=?1")
-	OrgEntity findRootOrg(String code);
+	@Query(value = "select t from OrgEntity t where t.parentId is null and t.code=?1")
+	OrgEntity findRootOrgByCode(String code);
 
-	@Query(value = "select from OrgEntity where parentId is null and id =?1")
-	OrgEntity findRootOrg(Long rootOrgId);
+	@Query(value = "select t from OrgEntity t where t.parentId is null and t.id =?1")
+	OrgEntity findRootOrgById(Long rootOrgId);
 
 }

+ 1 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java

@@ -103,7 +103,7 @@ public class AuthServiceImpl implements AuthService {
 			}
 
 			try {
-				rootOrg = orgRepo.findRootOrg(loginInfo.getDomain());
+				rootOrg = orgRepo.findRootOrgByCode(loginInfo.getDomain());
 				rootOrgId = rootOrg.getId();
 			} catch (Exception e) {
 				throw new StatusException("B-001002", "机构不存在", e);

+ 1 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgService.java

@@ -210,7 +210,7 @@ public class OrgService {
 		if (null == org.getParentId()) {
 
 			// 校验顶级机构编码已存在
-			OrgEntity rootOrg = orgRepo.findRootOrg(code);
+			OrgEntity rootOrg = orgRepo.findRootOrgByCode(code);
 			if (null != rootOrg) {
 				if (!(null != org.getId() && org.getId().equals(rootOrg.getId()))) {
 					throw new StatusException("B-150001", "顶级机构编码已存在");