|
@@ -5,11 +5,12 @@ import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.sooka.system.domain.SysDept;
|
|
|
+import com.sooka.system.domain.SysMenu;
|
|
|
import com.sooka.system.domain.SysRole;
|
|
|
import com.sooka.system.mapper.SysDeptMapper;
|
|
|
+import com.sooka.system.mapper.SysMenuMapper;
|
|
|
import com.sooka.system.service.ISysDeptService;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.sooka.common.annotation.DataScope;
|
|
@@ -18,6 +19,8 @@ import com.sooka.common.core.domain.Ztree;
|
|
|
import com.sooka.common.exception.BusinessException;
|
|
|
import com.sooka.common.utils.StringUtils;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
/**
|
|
|
* 部门管理 服务实现
|
|
|
*
|
|
@@ -26,8 +29,10 @@ import com.sooka.common.utils.StringUtils;
|
|
|
@Service
|
|
|
public class SysDeptServiceImpl implements ISysDeptService
|
|
|
{
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysDeptMapper deptMapper;
|
|
|
+ @Resource
|
|
|
+ private SysMenuMapper menuMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询部门管理数据
|
|
@@ -81,10 +86,48 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|
|
@Override
|
|
|
public List<Ztree> selectProvideDeptDataTree(String shareType)
|
|
|
{
|
|
|
- List<SysDept> deptList = deptMapper.selectProvideDeptDataList(shareType);
|
|
|
+ sysMenuList = new ArrayList();
|
|
|
+ List<SysMenu> list = menuMapper.selectMenuNormalAll();
|
|
|
+ Long menuId = 0L;
|
|
|
+ switch (shareType){
|
|
|
+ case "share_type_1"://市共享数据核验管理
|
|
|
+ menuId = 2089L;
|
|
|
+ break;
|
|
|
+ case "share_type_4":
|
|
|
+ menuId = 2088L;//省共享数据核验管理
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ getSysMenuListByParentId(menuId, list);
|
|
|
+ for (int m = 0; m < list.size(); m++) {
|
|
|
+ if(String.valueOf(list.get(m).getMenuId()).equals(String.valueOf(menuId))){
|
|
|
+ sysMenuList.add(list.get(m));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SysDept> deptList = new ArrayList();
|
|
|
+ for (int m = 0; m < sysMenuList.size(); m++) {
|
|
|
+ SysMenu menu = sysMenuList.get(m);
|
|
|
+ SysDept dept = new SysDept();
|
|
|
+ dept.setStatus("0");
|
|
|
+ dept.setDeptId(menu.getMenuId());
|
|
|
+ dept.setDeptName(menu.getMenuName());
|
|
|
+ dept.setParentId(menu.getParentId());
|
|
|
+ deptList.add(dept);
|
|
|
+ }
|
|
|
+// List<SysDept> deptList = deptMapper.selectProvideDeptDataList(shareType);//2088 省共享数据核验管理 2089 市共享数据核验管理
|
|
|
List<Ztree> ztrees = initZtree(deptList);
|
|
|
return ztrees;
|
|
|
}
|
|
|
+ List<SysMenu> sysMenuList = new ArrayList();
|
|
|
+ private void getSysMenuListByParentId(Long parentId, List<SysMenu> menuList){
|
|
|
+ for (int m = 0; m < menuList.size(); m++) {
|
|
|
+ SysMenu menu = menuList.get(m);
|
|
|
+ if(String.valueOf(menu.getParentId()).equals(String.valueOf(parentId))){
|
|
|
+ sysMenuList.add(menu);
|
|
|
+ getSysMenuListByParentId(menu.getMenuId(), menuList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询部门管理树(排除下级)
|