gongchunyi
11 小时以前 23992364d62892baebfba878a2ea9c944d0e4763
fix:资源要求-人员-奖惩记录,新增无员工信息问题
已修改5个文件
87 ■■■■ 文件已修改
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java
@@ -27,16 +27,15 @@
    private UserService userService;
    /**
     * todo:  type : 1: 获取检测人员信息
              type : 2: 获取当前登录用户部门下的所有用户
     *
     * @param user
     * @param type
     * @param type 1: 获取检测人员信息,2: 获取当前登录用户部门下的所有用户
     * @return
     */
    @ApiOperation(value = "根据条件获取用户列表")
    @GetMapping("/selectUserCondition")
    public Result selectUserCondition(User user, String type){
        return Result.success(userService.selectUserCondition(user, type));
    public Result selectUserCondition(User user, String type, Integer departmentId) {
        return Result.success(userService.selectUserCondition(user, type, departmentId));
    }
    /**
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
@@ -59,6 +59,13 @@
     */
    List<User> selectDepartmentLimsUserList(@Param("userId") Integer userId);
    /**
     * 获取部门ID查询对应的部门人员
     *
     * @param departmentId 部门ID
     * @return
     */
    List<User> selectUserByDepartmentId(@Param("departmentId") Integer departmentId);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
@@ -19,9 +19,10 @@
     * 根据条件获取用户列表
     * @param user
     * @param type
     * @param departmentId  部门ID
     * @return
     */
    List<User> selectUserCondition(User user, String type);
    List<User> selectUserCondition(User user, String type, Integer departmentId);
    /**
     * 获取当前登录的客户信息
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
@@ -26,23 +26,39 @@
    /**
     * 根据条件获取用户列表
     *      * todo:  type : 1: 获取检测人员信息
     *               type : 2: 获取当前登录用户部门下的所有用户
     * @param user
     * @param type
     * * todo:  type : 1: 获取检测人员信息
     * type : 2: 获取当前登录用户部门下的所有用户
     *
     * @param user         用户
     * @param type         类型
     * @param departmentId 部门ID
     * @return
     */
    @Override
    public List<User> selectUserCondition(User user, String type) {
        if (StringUtils.isNotEmpty(type)) {
    public List<User> selectUserCondition(User user, String type, Integer departmentId) {
            switch (type) {
                case "1":
                    return baseMapper.selectQualityUserList();
                case "2":
                    return baseMapper.selectDepartmentLimsUserList(SecurityUtils.getUserId().intValue());
            }
        if (!StringUtils.isNotEmpty(type)) {
            return baseMapper.selectUserCondition(QueryWrappers.queryWrappers(user), type);
        }
        switch (type) {
            case "1":
                // 检测人员
                return baseMapper.selectQualityUserList();
            case "2":
                Long currentUserId = SecurityUtils.getUserId();
                boolean isAdmin = SecurityUtils.isAdmin(currentUserId);
                //  管理员判断,传入部门ID就查对应的部门否则查询全部
                if (isAdmin) {
                    if (departmentId != null) {
                        return baseMapper.selectUserByDepartmentId(departmentId);
                    }
                    return baseMapper.selectUserCondition(QueryWrappers.queryWrappers(user), type);
                }
                return baseMapper.selectDepartmentLimsUserList(currentUserId.intValue());
        }
        return baseMapper.selectUserCondition(QueryWrappers.queryWrappers(user), type);
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
@@ -98,4 +98,32 @@
                                where u2.id = #{userId})
    </select>
    <select id="selectUserByDepartmentId" resultType="com.ruoyi.common.core.domain.entity.User"
            parameterType="java.lang.Integer">
        select id,
               dept_id,
               account,
               name,
               name_en,
               user_type,
               email,
               phone,
               sex,
               age,
               signature_url,
               picture_url,
               status,
               del_flag,
               login_ip,
               login_date,
               depart_lims_id,
               company,
               is_custom
        from user
        where del_flag = '0'
          and depart_lims_id is not null
          and depart_lims_id != ''
          and FIND_IN_SET(#{departmentId}, depart_lims_id)
    </select>
</mapper>