|
@@ -398,9 +398,10 @@ public class OrgController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询子机构树")
|
|
|
@GetMapping("querySubOrgTree")
|
|
|
- public List<OrgEntity> querySubOrgTree(@RequestParam(required = true) Long parentId,
|
|
|
+ public List<OrgDomain> querySubOrgTree(@RequestParam(required = true) Long parentId,
|
|
|
@RequestParam(required = false) Boolean enable,
|
|
|
- @RequestParam(required = false) Boolean includeMyself) {
|
|
|
+ @RequestParam(required = false) Boolean includeMyself,
|
|
|
+ @RequestParam(required = false) String propertyKeys) {
|
|
|
User accessUser = getAccessUser();
|
|
|
Long rootOrgId = accessUser.getRootOrgId();
|
|
|
|
|
@@ -432,13 +433,44 @@ public class OrgController extends ControllerSupport {
|
|
|
}
|
|
|
|
|
|
Sort sort = new Sort(Direction.ASC, "id");
|
|
|
- List<OrgEntity> list = orgRepo.findAll(specification, sort);
|
|
|
+ List<OrgEntity> orgEntityList = orgRepo.findAll(specification, sort);
|
|
|
|
|
|
if (null != includeMyself && includeMyself) {
|
|
|
- list.add(0, parentOrg);
|
|
|
+ orgEntityList.add(0, parentOrg);
|
|
|
}
|
|
|
|
|
|
- return list;
|
|
|
+ List<OrgDomain> ret = Lists.newArrayList();
|
|
|
+ Iterator<OrgEntity> iterator = orgEntityList.iterator();
|
|
|
+
|
|
|
+ List<String> propertyKeyList = null;
|
|
|
+ if (StringUtils.isNotBlank(propertyKeys)) {
|
|
|
+ propertyKeyList = RegExpUtil.findAll(propertyKeys, "\\w+");
|
|
|
+ }
|
|
|
+
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ OrgEntity next = iterator.next();
|
|
|
+ OrgDomain d = new OrgDomain();
|
|
|
+ ret.add(d);
|
|
|
+
|
|
|
+ d.setCode(next.getCode());
|
|
|
+ d.setContacts(next.getContacts());
|
|
|
+ d.setEnable(next.getEnable());
|
|
|
+ d.setId(next.getId());
|
|
|
+ d.setName(next.getName());
|
|
|
+ d.setParentId(next.getParentId());
|
|
|
+ d.setRemark(next.getRemark());
|
|
|
+ d.setRootId(next.getRootId());
|
|
|
+ d.setTelephone(next.getTelephone());
|
|
|
+ d.setCreationTime(next.getCreationTime());
|
|
|
+ d.setUpdateTime(next.getUpdateTime());
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(propertyKeyList)) {
|
|
|
+ Map<String, String> properties = getProperties(d.getId(), propertyKeyList);
|
|
|
+ d.setProperties(properties);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/**
|