wangwei 6 年之前
父节点
当前提交
829d8313ff

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

@@ -388,37 +388,22 @@ public class OrgController extends ControllerSupport {
 	 * 方法注释
 	 *
 	 * @author WANGWEI
-	 * @param parentId
-	 *            父机构ID
 	 * @param enable
 	 *            是否可用
-	 * @param includeMyself
+	 * @param includeRoot
 	 *            返回集合是否包含parentId对应的机构对象
 	 * @return
 	 */
-	@ApiOperation(value = "查询子机构树")
-	@GetMapping("querySubOrgTree")
-	public List<OrgDomain> querySubOrgTree(@RequestParam(required = true) Long parentId,
-			@RequestParam(required = false) Boolean enable,
-			@RequestParam(required = false) Boolean includeMyself,
+	@ApiOperation(value = "查询全量机构树")
+	@GetMapping("queryFullOrgTree")
+	public List<OrgDomain> queryFullOrgTree(@RequestParam(required = false) Boolean enable,
 			@RequestParam(required = false) String propertyKeys) {
 		User accessUser = getAccessUser();
 		Long rootOrgId = accessUser.getRootOrgId();
 
-		if (null == parentId) {
-			throw new StatusException("B-001249", "parentId is null");
-		}
-
-		OrgEntity parentOrg = orgRepo.findOne(parentId);
-		if (null == parentOrg) {
-			throw new StatusException("B-001250", "parentId is wrong");
-		}
-		validateRootOrgIsolation(parentOrg.getRootId());
-
 		Specification<OrgEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
 			predicates.add(cb.equal(root.get("rootId"), rootOrgId));
-			predicates.add(cb.equal(root.get("parentId"), parentId));
 			if (null != enable) {
 				predicates.add(cb.equal(root.get("enable"), enable));
 			}
@@ -435,10 +420,6 @@ public class OrgController extends ControllerSupport {
 		Sort sort = new Sort(Direction.ASC, "id");
 		List<OrgEntity> orgEntityList = orgRepo.findAll(specification, sort);
 
-		if (null != includeMyself && includeMyself) {
-			orgEntityList.add(0, parentOrg);
-		}
-
 		List<OrgDomain> ret = Lists.newArrayList();
 		Iterator<OrgEntity> iterator = orgEntityList.iterator();