|
|
@@ -26,6 +26,7 @@ import com.xunmei.system.mapper.SysOrgMapper;
|
|
|
import com.xunmei.system.mapper.SysRoleMapper;
|
|
|
import com.xunmei.system.service.ISysDeptService;
|
|
|
import com.xunmei.system.service.ISysOrgService;
|
|
|
+import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -111,9 +112,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
* @return 机构树信息集合
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysOrgVO> selectDeptTreeList() {
|
|
|
+ public List<SysOrgVO> selectDeptTreeList(SysOrg dept) {
|
|
|
Long s = System.currentTimeMillis();
|
|
|
- SysOrg sysOrg = getLoginUserOrg();
|
|
|
+ SysOrg sysOrg = null;
|
|
|
+ sysOrg = getLoginUserOrg();
|
|
|
List<SysOrgVO> cacheList = getOrgCache();
|
|
|
List<SysOrgVO> orgs = new ArrayList<>();
|
|
|
for (SysOrgVO org : cacheList) {
|
|
|
@@ -125,12 +127,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
if (StringUtils.isEmpty(org.getShortName())) {
|
|
|
org.setShortName(org.getName());
|
|
|
}
|
|
|
- if(org.getSort() == null){
|
|
|
+ if (org.getSort() == null) {
|
|
|
org.setSort(100000);
|
|
|
}
|
|
|
orgs.add(org);
|
|
|
}
|
|
|
-
|
|
|
+ if (dept.getRemoveId() != null) {
|
|
|
+ orgs.removeIf(d -> d.getId().equals(dept.getRemoveId()));
|
|
|
+ }
|
|
|
return generateTree(orgs, sysOrg);
|
|
|
}
|
|
|
|
|
|
@@ -152,7 +156,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
public List<SysOrgVO> getHangsheTreeCache(String path) {
|
|
|
List<SysOrgVO> cacheList = getOrgCache();
|
|
|
List<SysOrgVO> hangshelist = cacheList.stream().filter(c -> ObjectUtil.equal(c.getType(), 3)
|
|
|
- && ObjectUtil.isNotEmpty(c.getPath()) && c.getPath().startsWith(path))
|
|
|
+ && ObjectUtil.isNotEmpty(c.getPath()) && c.getPath().startsWith(path))
|
|
|
.collect(Collectors.toList());
|
|
|
Set<Long> hangsheSet = hangshelist.stream().map(o -> o.getId()).collect(Collectors.toSet());
|
|
|
Set<Long> parentIds = new HashSet<>();
|