|
@@ -139,6 +139,28 @@ public class OrgController extends ControllerSupport {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 方法注释
|
|
|
|
+ *
|
|
|
|
+ * @author WANGWEI
|
|
|
|
+ * @param rootOrgId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation(value = "按ID查询顶级机构", notes = "ID查询")
|
|
|
|
+ @GetMapping("rootOrg/{rootOrgId}")
|
|
|
|
+ public OrgEntity getRootOrg(@PathVariable Long rootOrgId) {
|
|
|
|
+ OrgEntity orgEntity = orgRepo.findOne(rootOrgId);
|
|
|
|
+ if (null == orgEntity) {
|
|
|
|
+ throw new StatusException("B-001250", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
+ if (null != orgEntity.getParentId()) {
|
|
|
|
+ throw new StatusException("B-001251", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
+ validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
+
|
|
|
|
+ return orgEntity;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 方法注释
|
|
* 方法注释
|
|
*
|
|
*
|
|
@@ -146,13 +168,16 @@ public class OrgController extends ControllerSupport {
|
|
* @param orgId
|
|
* @param orgId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @ApiOperation(value = "按ID查询机构", notes = "ID查询")
|
|
|
|
- @GetMapping("{orgId}")
|
|
|
|
- public OrgEntity getOrg(@PathVariable Long orgId) {
|
|
|
|
|
|
+ @ApiOperation(value = "按ID查询顶级机构", notes = "ID查询")
|
|
|
|
+ @GetMapping("subOrg/{orgId}")
|
|
|
|
+ public OrgEntity getSubOrg(@PathVariable Long orgId) {
|
|
OrgEntity orgEntity = orgRepo.findOne(orgId);
|
|
OrgEntity orgEntity = orgRepo.findOne(orgId);
|
|
if (null == orgEntity) {
|
|
if (null == orgEntity) {
|
|
throw new StatusException("B-001250", "orgId is wrong");
|
|
throw new StatusException("B-001250", "orgId is wrong");
|
|
}
|
|
}
|
|
|
|
+ if (null == orgEntity.getParentId()) {
|
|
|
|
+ throw new StatusException("B-001251", "orgId is wrong");
|
|
|
|
+ }
|
|
validateRootOrgIsolation(orgEntity.getRootId());
|
|
validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
|
|
return orgEntity;
|
|
return orgEntity;
|