| | |
| | | @AllArgsConstructor |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/dept") |
| | | @Api(value = "部门", tags = "部门") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public class DeptController extends BladeController { |
| | | |
| | | private final IDeptService deptService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-trees") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> lazyTrees() { |
| | | List<DeptVO> tree = deptService.lazyTrees(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | |
| | | @ApiModelProperty(value = "入职时间") |
| | | private String rtime; |
| | | private String hold; |
| | | private String jurisdiction; |
| | | |
| | | |
| | | } |
| | |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | | * @return |
| | | */ |
| | | List<DeptVO> lazyTrees(); |
| | | |
| | | /** |
| | | * 获取部门名 |
| | | * |
| | | * @param ids |
| | |
| | | */ |
| | | List<String> getDeptNames(Long[] ids); |
| | | |
| | | /** |
| | | * 分局树状信息 |
| | | * @return |
| | | */ |
| | | List<String> selectIn(); |
| | | List<Map<Object,String>> selectCount(String name); |
| | | List<Map<Object,String>> selectId(String id); |
| | | Map<Object,Integer> selectHold(String deptid); |
| | | |
| | | } |
| | |
| | | ORDER BY dept.sort |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="lazyTrees" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | | dept.parent_id, |
| | | dept.dept_name AS title, |
| | | dept.id AS "value", |
| | | dept.id AS "key", |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 0 ELSE 1 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept WHERE ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) =1 |
| | | </select> |
| | | |
| | | <select id="getDeptNames" resultType="java.lang.String"> |
| | | SELECT |
| | | dept_name |
| | |
| | | and is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectIn" resultType="java.util.HashMap"> |
| | | SELECT |
| | | id, |
| | | dept_name |
| | | FROM |
| | | blade_dept |
| | | </select> |
| | | |
| | | <!--统计单位类型数量--> |
| | | <select id="selectCount" resultType="java.util.HashMap"> |
| | | SELECT dept.id as jurisdiction,dept.dept_name AS title FROM blade_dept dept WHERE dept.dept_name like concat(concat('%', #{name}),'%') |
| | | </select> |
| | | |
| | | <select id="selectHold" resultType="java.util.HashMap"> |
| | | SELECT |
| | | ISNULL(B.cz,0) as cz, |
| | | ISNULL(C.wcz,0) as wcz |
| | | FROM (SELECT jurisdiction FROM blade_user ) A |
| | | LEFT JOIN (SELECT COUNT(hold) as cz,jurisdiction FROM blade_user WHERE hold=0 GROUP BY jurisdiction ) B ON A.jurisdiction=B.jurisdiction |
| | | LEFT JOIN (SELECT COUNT(hold) as wcz,jurisdiction FROM blade_user WHERE hold=1 GROUP BY jurisdiction ) C ON A.jurisdiction=C.jurisdiction |
| | | WHERE A.jurisdiction=#{deptid} GROUP BY cz,wcz |
| | | </select> |
| | | |
| | | <!--查询部门下面的所有单位--> |
| | | <select id="selectId" resultType="java.util.HashMap"> |
| | | SELECT id FROM blade_dept WHERE parent_id =#{id} and is_deleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="registered" property="registered"/> |
| | | <result column="rtime" property="rtime"/> |
| | | <result column="hold" property="hold"/> |
| | | <result column="jurisdiction" property="jurisdiction"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectUserPage" resultMap="userResultMap"> |
| | |
| | | </if> |
| | | <if test="user.hold!=null and user.hold != ''"> |
| | | and hold = #{user.hold} |
| | | </if> <if test="user.jurisdiction!=null and user.jurisdiction != ''"> |
| | | and jurisdiction = #{user.jurisdiction} |
| | | </if> |
| | | <if test="deptIdList!=null and deptIdList.size>0"> |
| | | and id in ( |
| | |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | | * @return |
| | | */ |
| | | List<DeptVO> lazyTrees(); |
| | | |
| | | /** |
| | | * 获取部门ID |
| | | * |
| | | * @param tenantId |
| | |
| | | * @return |
| | | */ |
| | | List<DeptVO> search(String deptName, Long parentId); |
| | | |
| | | List<Map<Object,String>> selectCount(String name); |
| | | List<Map<Object,String>> selectId(String id); |
| | | Map<Object,Integer> selectHold(String deptid); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> lazyTrees() { |
| | | return ForestNodeMerger.merge(baseMapper.lazyTrees()); |
| | | } |
| | | |
| | | @Override |
| | | public String getDeptIds(String tenantId, String deptNames) { |
| | | List<Dept> deptList = baseMapper.selectList(Wrappers.<Dept>query().lambda().eq(Dept::getTenantId, tenantId).in(Dept::getDeptName, Func.toStrList(deptNames))); |
| | | if (deptList != null && deptList.size() > 0) { |
| | |
| | | return DeptWrapper.build().listNodeVO(deptList); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<Object,String>> selectCount(String name) { |
| | | return baseMapper.selectCount(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<Object, String>> selectId(String id) { |
| | | return baseMapper.selectId(id); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Object, Integer> selectHold(String deptid) { |
| | | return baseMapper.selectHold(deptid); |
| | | } |
| | | |
| | | } |