接口调整
This commit is contained in:
parent
866673f97f
commit
86dd75d7d4
@ -4,6 +4,7 @@ import com.zhgd.annotation.OperLog;
|
|||||||
import com.zhgd.jeecg.common.api.vo.Result;
|
import com.zhgd.jeecg.common.api.vo.Result;
|
||||||
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
|
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
|
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -198,7 +199,7 @@ public class BaseMenuController {
|
|||||||
@ApiOperation(value = "获取角色的菜单权限", notes = "获取角色的菜单权限" , httpMethod="POST")
|
@ApiOperation(value = "获取角色的菜单权限", notes = "获取角色的菜单权限" , httpMethod="POST")
|
||||||
@ApiImplicitParam(name = "roleId", value = "系统角色表ID", paramType = "query", required = true, dataType = "Long")
|
@ApiImplicitParam(name = "roleId", value = "系统角色表ID", paramType = "query", required = true, dataType = "Long")
|
||||||
@PostMapping(value = "/queryByRole")
|
@PostMapping(value = "/queryByRole")
|
||||||
public Result<Set<Long>> queryByRole(@RequestBody Map<String,Object> map) {
|
public Result<List<SystemRoleMenu>> queryByRole(@RequestBody Map<String,Object> map) {
|
||||||
return Result.success(baseMenuService.roleMenu(MapUtils.getString(map,"roleId")));
|
return Result.success(baseMenuService.roleMenu(MapUtils.getString(map,"roleId")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,10 +60,10 @@ public class EntSystemDeptController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
||||||
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
|
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
|
||||||
@PostMapping(value = "/tree")
|
@GetMapping(value = "/tree")
|
||||||
public Result<List<SystemDept>> queryTreeList() {
|
public Result<List<SystemDept>> queryTreeList() {
|
||||||
List<SystemDept> tree = systemDeptService.tree(0);
|
List<SystemDept> tree = systemDeptService.tree(0L);
|
||||||
return Result.success(tree);
|
return Result.success(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,10 +60,10 @@ public class GovSystemDeptController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
||||||
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
|
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
|
||||||
@PostMapping(value = "/tree")
|
@GetMapping(value = "/tree")
|
||||||
public Result<List<SystemDept>> queryTreeList() {
|
public Result<List<SystemDept>> queryTreeList() {
|
||||||
List<SystemDept> tree = systemDeptService.tree(0);
|
List<SystemDept> tree = systemDeptService.tree(0L);
|
||||||
return Result.success(tree);
|
return Result.success(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,10 +60,10 @@ public class SystemDeptController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
|
||||||
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
|
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
|
||||||
@PostMapping(value = "/tree")
|
@GetMapping(value = "/tree")
|
||||||
public Result<List<SystemDept>> queryTreeList() {
|
public Result<List<SystemDept>> queryTreeList() {
|
||||||
List<SystemDept> tree = systemDeptService.tree(0);
|
List<SystemDept> tree = systemDeptService.tree(0L);
|
||||||
return Result.success(tree);
|
return Result.success(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,5 +14,5 @@ public class SystemUserDto extends SystemUser {
|
|||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户角色")
|
@ApiModelProperty(value = "用户角色")
|
||||||
private String roleId;
|
private String roleName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public class SystemDept implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 部门id
|
* 部门id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@ApiModelProperty(value = "部门id(主键ID)")
|
@ApiModelProperty(value = "部门id(主键ID)")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ public class SystemDept implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "父部门id", width = 15)
|
@Excel(name = "父部门id", width = 15)
|
||||||
@ApiModelProperty(value = "父部门id")
|
@ApiModelProperty(value = "父部门id")
|
||||||
private Integer parentId;
|
private Long parentId;
|
||||||
/**
|
/**
|
||||||
* 祖级列表
|
* 祖级列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,22 +35,15 @@ public class SystemRoleMenu implements Serializable {
|
|||||||
@ApiModelProperty(value = "角色id")
|
@ApiModelProperty(value = "角色id")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
/**
|
/**
|
||||||
* 菜单id
|
* 对应权限id
|
||||||
*/
|
*/
|
||||||
@Excel(name = "菜单id", width = 15)
|
@Excel(name = "对应权限id", width = 15)
|
||||||
@ApiModelProperty(value = "菜单id")
|
@ApiModelProperty(value = "对应权限id")
|
||||||
private Long menuId;
|
private Long authorityId;
|
||||||
/**
|
/**
|
||||||
* 权限id
|
* 菜单类型,0:模块 1:菜单;2:按钮
|
||||||
*/
|
*/
|
||||||
@Excel(name = "权限id", width = 15)
|
@Excel(name = "菜单类型,0:模块 1:菜单;2:按钮", width = 15)
|
||||||
@ApiModelProperty(value = "权限id")
|
@ApiModelProperty(value = "菜单类型,0:模块 1:菜单;2:按钮")
|
||||||
private Long actionId;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
|
||||||
* 模块id
|
|
||||||
*/
|
|
||||||
@Excel(name = "模块id", width = 15)
|
|
||||||
@ApiModelProperty(value = "模块id")
|
|
||||||
private Long moduleId;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,6 @@ public class SystemUser implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "创建时间", width = 15)
|
@Excel(name = "创建时间", width = 15)
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
/**
|
/**
|
||||||
* 人员姓名
|
* 人员姓名
|
||||||
@ -92,11 +91,11 @@ public class SystemUser implements Serializable {
|
|||||||
@ApiModelProperty(value = "项目子账号绑定的人员ID")
|
@ApiModelProperty(value = "项目子账号绑定的人员ID")
|
||||||
private Integer workerId;
|
private Integer workerId;
|
||||||
/**
|
/**
|
||||||
* 组织岗位Id
|
* 组织岗位
|
||||||
*/
|
*/
|
||||||
@Excel(name = "组织岗位Id", width = 15)
|
@Excel(name = "组织岗位", width = 15)
|
||||||
@ApiModelProperty(value = "组织岗位Id")
|
@ApiModelProperty(value = "组织岗位")
|
||||||
private Integer jobId;
|
private String jobName;
|
||||||
/**
|
/**
|
||||||
* 外部第三方账号
|
* 外部第三方账号
|
||||||
*/
|
*/
|
||||||
@ -122,6 +121,14 @@ public class SystemUser implements Serializable {
|
|||||||
@ApiModelProperty(value = "邮箱")
|
@ApiModelProperty(value = "邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Excel(name = "性别(0女;1男)", width = 15)
|
||||||
|
@ApiModelProperty(value = "性别(0女;1男)")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Excel(name = "备注", width = 15)
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "token")
|
@ApiModelProperty(value = "token")
|
||||||
private String token;
|
private String token;
|
||||||
|
|||||||
@ -28,4 +28,6 @@ public interface BaseMenuMapper extends BaseMapper<BaseMenu> {
|
|||||||
List<EntityMap> selectHeadquartersMenuList(Map<String, Object> param);
|
List<EntityMap> selectHeadquartersMenuList(Map<String, Object> param);
|
||||||
|
|
||||||
List<EntityMap> selectComapnyUserMenuList(Map<String, Object> param);
|
List<EntityMap> selectComapnyUserMenuList(Map<String, Object> param);
|
||||||
|
|
||||||
|
List<BaseMenu> getMenuIdByFilter(Long roleId, Long moduleId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,4 +54,9 @@
|
|||||||
WHERE b.user_id=#{userId} and a.status=1 and m.style_type=#{styleType}
|
WHERE b.user_id=#{userId} and a.status=1 and m.style_type=#{styleType}
|
||||||
order by a.parent_id,a.priority
|
order by a.parent_id,a.priority
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getMenuIdByFilter" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseMenu">
|
||||||
|
SELECT m.* FROM system_role_menu r LEFT JOIN base_menu m ON r.authority_id = m.menu_id AND r.type = 1
|
||||||
|
WHERE m.module_id = #{moduleId} AND r.role_id = #{roleId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -13,9 +13,10 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPageList" resultType="com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto">
|
<select id="getPageList" resultType="com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto">
|
||||||
SELECT <include refid="userInfo"></include>, d.dept_name, ur.role_id FROM system_user u
|
SELECT <include refid="userInfo"></include>, d.dept_name, r.role_name FROM system_user u
|
||||||
LEFT JOIN system_dept d ON u.department = d.dept_id
|
LEFT JOIN system_dept d ON u.department = d.dept_id
|
||||||
LEFT JOIN user_role ur ON u.user_id = ur.user_id
|
LEFT JOIN system_user_role ur ON u.user_id = ur.user_id
|
||||||
|
LEFT JOIN system_role r ON ur.role_id = r.role_id
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -6,6 +6,7 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
|||||||
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
|
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -49,7 +50,7 @@ public interface IBaseMenuService extends IService<BaseMenu> {
|
|||||||
|
|
||||||
List<MenuTreeDto> myTreeMenu(Long moduleId);
|
List<MenuTreeDto> myTreeMenu(Long moduleId);
|
||||||
|
|
||||||
Set<Long> roleMenu(String roleId);
|
List<SystemRoleMenu> roleMenu(String roleId);
|
||||||
|
|
||||||
Set<String> queryRouter();
|
Set<String> queryRouter();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISystemDeptService extends IService<SystemDept> {
|
public interface ISystemDeptService extends IService<SystemDept> {
|
||||||
|
|
||||||
List<SystemDept> tree(Integer deptId);
|
List<SystemDept> tree(Long deptId);
|
||||||
|
|
||||||
boolean saveInfo(SystemDept systemDept);
|
boolean saveInfo(SystemDept systemDept);
|
||||||
|
|
||||||
|
|||||||
@ -99,13 +99,10 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
|||||||
// 查询相对应的菜单
|
// 查询相对应的菜单
|
||||||
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId));
|
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId));
|
||||||
} else {
|
} else {
|
||||||
List<Long> roleIds = systemUserRoleService.list(Wrappers.<SystemUserRole>lambdaQuery()
|
Long roleId = systemUserRoleService.getOne(Wrappers.<SystemUserRole>lambdaQuery()
|
||||||
.eq(SystemUserRole::getUserId, user.getUserId())).stream().map(r -> r.getRoleId()).collect(Collectors.toList());
|
.eq(SystemUserRole::getUserId, user.getUserId())).getRoleId();
|
||||||
if (roleIds.size() > 0) {
|
if (roleId != null) {
|
||||||
List<Long> menuIds = systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
|
baseMenus = baseMenuMapper.getMenuIdByFilter(roleId, moduleId);
|
||||||
.in(SystemRoleMenu::getRoleId, roleIds).eq(SystemRoleMenu::getModuleId, moduleId)
|
|
||||||
).stream().map(r -> r.getMenuId()).collect(Collectors.toList());
|
|
||||||
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getMenuId, menuIds));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (baseMenus.size() == 0) {
|
if (baseMenus.size() == 0) {
|
||||||
@ -117,18 +114,10 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Long> roleMenu(String roleId) {
|
public List<SystemRoleMenu> roleMenu(String roleId) {
|
||||||
Set<Long> ids = new HashSet<>();
|
|
||||||
// 查询角色下的菜单
|
// 查询角色下的菜单
|
||||||
List<SystemRoleMenu> systemRoleMenus = systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
|
return systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
|
||||||
.eq(SystemRoleMenu::getRoleId, roleId));
|
.eq(SystemRoleMenu::getRoleId, roleId));
|
||||||
for (SystemRoleMenu systemRoleMenu : systemRoleMenus) {
|
|
||||||
ids.add(systemRoleMenu.getModuleId());
|
|
||||||
ids.add(systemRoleMenu.getMenuId());
|
|
||||||
ids.add(systemRoleMenu.getActionId());
|
|
||||||
}
|
|
||||||
ids.remove(null);
|
|
||||||
return ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -61,7 +61,9 @@ public class GovernmentServiceImpl extends ServiceImpl<GovernmentMapper, Governm
|
|||||||
}
|
}
|
||||||
for (Government government : pageList.getRecords()) {
|
for (Government government : pageList.getRecords()) {
|
||||||
if (government.getExpireTime() != null) {
|
if (government.getExpireTime() != null) {
|
||||||
government.setDiffDay((int) DateUtil.between(new Date(), government.getExpireTime(), DateUnit.DAY));
|
Integer between = (int) DateUtil.between(new Date(), government.getExpireTime(), DateUnit.DAY, false);
|
||||||
|
government.setDiffDay(between > 0 ? between : 0);
|
||||||
|
government.setState(between > 0 ? government.getState() : 0);
|
||||||
}
|
}
|
||||||
government.setInstallProject(projectList.stream().filter(p -> p.getGovernmentSn().equals(government.getGovernmentSn())).count());
|
government.setInstallProject(projectList.stream().filter(p -> p.getGovernmentSn().equals(government.getGovernmentSn())).count());
|
||||||
}
|
}
|
||||||
@ -131,6 +133,11 @@ public class GovernmentServiceImpl extends ServiceImpl<GovernmentMapper, Governm
|
|||||||
if (accountType == 2) {
|
if (accountType == 2) {
|
||||||
govSn = sn;
|
govSn = sn;
|
||||||
}
|
}
|
||||||
return this.getOne(Wrappers.<Government>lambdaQuery().eq(Government::getGovernmentSn, govSn));
|
Government government = this.getOne(Wrappers.<Government>lambdaQuery().eq(Government::getGovernmentSn, govSn));
|
||||||
|
if (government.getExpireTime().before(new Date())) {
|
||||||
|
government.setState(0);
|
||||||
|
this.updateById(government);
|
||||||
|
}
|
||||||
|
return government;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,12 +24,12 @@ import java.util.stream.Collectors;
|
|||||||
public class SystemDeptServiceImpl extends ServiceImpl<SystemDeptMapper, SystemDept> implements ISystemDeptService {
|
public class SystemDeptServiceImpl extends ServiceImpl<SystemDeptMapper, SystemDept> implements ISystemDeptService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SystemDept> tree(Integer deptId) {
|
public List<SystemDept> tree(Long deptId) {
|
||||||
SecurityUser user = SecurityUtil.getUser();
|
SecurityUser user = SecurityUtil.getUser();
|
||||||
List<SystemDept> list = this.list(Wrappers.<SystemDept>lambdaQuery().eq(SystemDept::getSn, user.getSn()));
|
List<SystemDept> list = this.list(Wrappers.<SystemDept>lambdaQuery().eq(SystemDept::getSn, user.getSn()));
|
||||||
List<SystemDept> treeList = new ArrayList<>();
|
List<SystemDept> treeList = new ArrayList<>();
|
||||||
if (deptId == 0) {
|
if (deptId.equals(0L)) {
|
||||||
treeList = list.stream().filter(d -> d.getParentId().equals(0)).collect(Collectors.toList());
|
treeList = list.stream().filter(d -> d.getParentId().equals(0L)).collect(Collectors.toList());
|
||||||
getTreeList(treeList, list);
|
getTreeList(treeList, list);
|
||||||
} else {
|
} else {
|
||||||
treeList = list.stream().filter(d -> d.getDeptId().equals(deptId)).collect(Collectors.toList());
|
treeList = list.stream().filter(d -> d.getDeptId().equals(deptId)).collect(Collectors.toList());
|
||||||
@ -62,7 +62,7 @@ public class SystemDeptServiceImpl extends ServiceImpl<SystemDeptMapper, SystemD
|
|||||||
|
|
||||||
private List<SystemDept> getTreeList(List<SystemDept> treeList, List<SystemDept> list) {
|
private List<SystemDept> getTreeList(List<SystemDept> treeList, List<SystemDept> list) {
|
||||||
for (SystemDept systemDept : treeList) {
|
for (SystemDept systemDept : treeList) {
|
||||||
List<SystemDept> children = this.list(Wrappers.<SystemDept>lambdaQuery().eq(SystemDept::getParentId, systemDept.getDeptId()));
|
List<SystemDept> children = list.stream().filter(d -> d.getParentId().equals(systemDept.getDeptId())).collect(Collectors.toList());
|
||||||
getTreeList(children, list);
|
getTreeList(children, list);
|
||||||
systemDept.setChildren(children);
|
systemDept.setChildren(children);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user