mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	完成用户的添加和修改的逻辑
This commit is contained in:
		| @@ -26,13 +26,13 @@ import static cn.iocoder.dashboard.common.pojo.CommonResult.success; | ||||
| public class SysDeptController { | ||||
|  | ||||
|     @Resource | ||||
|     private SysDeptService sysDeptService; | ||||
|     private SysDeptService deptService; | ||||
|  | ||||
|     @ApiOperation("获取部门列表") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:dept:list')") | ||||
|     @GetMapping("/list") | ||||
|     public CommonResult<List<SysDeptRespVO>> listDepts(SysDeptListReqVO reqVO) { | ||||
|         List<SysDeptDO> list = sysDeptService.listDepts(reqVO); | ||||
|         List<SysDeptDO> list = deptService.listDepts(reqVO); | ||||
|         list.sort(Comparator.comparing(SysDeptDO::getSort)); | ||||
|         return success(SysDeptConvert.INSTANCE.convertList(list)); | ||||
|     } | ||||
| @@ -43,8 +43,8 @@ public class SysDeptController { | ||||
|         // 获得部门列表,只要开启状态的 | ||||
|         SysDeptListReqVO reqVO = new SysDeptListReqVO(); | ||||
|         reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | ||||
|         List<SysDeptDO> list = sysDeptService.listDepts(reqVO); | ||||
|         // 排序后,返回个诶前端 | ||||
|         List<SysDeptDO> list = deptService.listDepts(reqVO); | ||||
|         // 排序后,返回给前端 | ||||
|         list.sort(Comparator.comparing(SysDeptDO::getSort)); | ||||
|         return success(SysDeptConvert.INSTANCE.convertList02(list)); | ||||
|     } | ||||
|   | ||||
| @@ -0,0 +1,40 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.dept; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.enums.CommonStatusEnum; | ||||
| import cn.iocoder.dashboard.common.pojo.CommonResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostSimpleRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.convert.dept.SysPostConvert; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
| import cn.iocoder.dashboard.modules.system.service.dept.SysPostService; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.Collections; | ||||
| import java.util.Comparator; | ||||
| import java.util.List; | ||||
|  | ||||
| import static cn.iocoder.dashboard.common.pojo.CommonResult.success; | ||||
|  | ||||
| @Api(tags = "岗位 API") | ||||
| @RestController | ||||
| @RequestMapping("/system/post") | ||||
| public class SysPostController { | ||||
|  | ||||
|     @Resource | ||||
|     private SysPostService postService; | ||||
|  | ||||
|     @ApiOperation(value = "获取岗位精简信息列表", notes = "只包含被开启的岗位,主要用于前端的下拉选项") | ||||
|     @GetMapping("/list-all-simple") | ||||
|     public CommonResult<List<SysPostSimpleRespVO>> listSimplePosts() { | ||||
|         // 获得岗位列表,只要开启状态的 | ||||
|         List<SysPostDO> list = postService.listPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus())); | ||||
|         // 排序后,返回给前端 | ||||
|         list.sort(Comparator.comparing(SysPostDO::getSort)); | ||||
|         return success(SysPostConvert.INSTANCE.convertList02(list)); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -3,8 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.user; | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.iocoder.dashboard.common.pojo.CommonResult; | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageItemRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.*; | ||||
| import cn.iocoder.dashboard.modules.system.convert.user.SysUserConvert; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysDeptDO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; | ||||
| @@ -12,10 +11,10 @@ import cn.iocoder.dashboard.modules.system.service.dept.SysDeptService; | ||||
| import cn.iocoder.dashboard.modules.system.service.user.SysUserService; | ||||
| import cn.iocoder.dashboard.util.collection.CollectionUtils; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.*; | ||||
| @@ -59,7 +58,36 @@ public class SysUserController { | ||||
|         }); | ||||
|         return success(new PageResult<>(userList, pageResult.getTotal())); | ||||
|     } | ||||
| // | ||||
|  | ||||
|     /** | ||||
|      * 根据用户编号获取详细信息 | ||||
|      */ | ||||
|     @ApiOperation("获得用户详情") | ||||
|     @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024") | ||||
|     @GetMapping("/get") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:query')") | ||||
|     public CommonResult<SysUserRespVO> getInfo(@RequestParam("id") Long id) { | ||||
|         return success(SysUserConvert.INSTANCE.convert(userService.getUser(id))); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("新增用户") | ||||
|     @PostMapping("/create") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:add')") | ||||
| //    @Log(title = "用户管理", businessType = BusinessType.INSERT) | ||||
|     public CommonResult<Long> createUser(@Validated @RequestBody SysUserCreateReqVO reqVO) { | ||||
|         Long id = userService.createUser(reqVO); | ||||
|         return success(id); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("修改用户") | ||||
|     @PostMapping("update") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:edit')") | ||||
| //    @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||
|     public CommonResult<Boolean> updateUser(@Validated @RequestBody SysUserUpdateReqVO reqVO) { | ||||
|         userService.updateUser(reqVO); | ||||
|         return success(true); | ||||
|     } | ||||
|  | ||||
| //    @Log(title = "用户管理", businessType = BusinessType.EXPORT) | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:export')") | ||||
| //    @GetMapping("/export") | ||||
| @@ -90,76 +118,8 @@ public class SysUserController { | ||||
| //        return util.importTemplateExcel("用户数据"); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 根据用户编号获取详细信息 | ||||
| //     */ | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:query')") | ||||
| //    @GetMapping(value = { "/", "/{userId}" }) | ||||
| //    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) | ||||
| //    { | ||||
| //        AjaxResult ajax = AjaxResult.success(); | ||||
| //        List<SysRole> roles = roleService.selectRoleAll(); | ||||
| //        ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); | ||||
| //        ajax.put("posts", postService.selectPostAll()); | ||||
| //        if (StringUtils.isNotNull(userId)) | ||||
| //        { | ||||
| //            ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); | ||||
| //            ajax.put("postIds", postService.selectPostListByUserId(userId)); | ||||
| //            ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); | ||||
| //        } | ||||
| //        return ajax; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 新增用户 | ||||
| //     */ | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:add')") | ||||
| //    @Log(title = "用户管理", businessType = BusinessType.INSERT) | ||||
| //    @PostMapping | ||||
| //    public AjaxResult add(@Validated @RequestBody SysUser user) | ||||
| //    { | ||||
| //        if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) | ||||
| //        { | ||||
| //            return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); | ||||
| //        } | ||||
| //        else if (StringUtils.isNotEmpty(user.getPhonenumber()) | ||||
| //                && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) | ||||
| //        { | ||||
| //            return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); | ||||
| //        } | ||||
| //        else if (StringUtils.isNotEmpty(user.getEmail()) | ||||
| //                && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) | ||||
| //        { | ||||
| //            return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); | ||||
| //        } | ||||
| //        user.setCreateBy(SecurityUtils.getUsername()); | ||||
| //        user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); | ||||
| //        return toAjax(userService.insertUser(user)); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改用户 | ||||
| //     */ | ||||
| //    @PreAuthorize("@ss.hasPermi('system:user:edit')") | ||||
| //    @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||
| //    @PutMapping | ||||
| //    public AjaxResult edit(@Validated @RequestBody SysUser user) | ||||
| //    { | ||||
| //        userService.checkUserAllowed(user); | ||||
| //        if (StringUtils.isNotEmpty(user.getPhonenumber()) | ||||
| //                && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) | ||||
| //        { | ||||
| //            return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); | ||||
| //        } | ||||
| //        else if (StringUtils.isNotEmpty(user.getEmail()) | ||||
| //                && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) | ||||
| //        { | ||||
| //            return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); | ||||
| //        } | ||||
| //        user.setUpdateBy(SecurityUtils.getUsername()); | ||||
| //        return toAjax(userService.updateUser(user)); | ||||
| //    } | ||||
| // | ||||
|  | ||||
|  | ||||
| //    /** | ||||
| //     * 删除用户 | ||||
| //     */ | ||||
|   | ||||
| @@ -2,11 +2,21 @@ package cn.iocoder.dashboard.modules.system.controller.user.vo.user; | ||||
|  | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import org.hibernate.validator.constraints.Length; | ||||
|  | ||||
| import javax.validation.constraints.NotEmpty; | ||||
|  | ||||
| @ApiModel("用户创建 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysUserCreateReqVO extends SysUserBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "密码", required = true, example = "123456") | ||||
|     @NotEmpty(message = "密码不能为空") | ||||
|     @Length(min = 4, max = 16, message = "密码长度为 4-16 位") | ||||
|     private String password; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,17 @@ | ||||
| package cn.iocoder.dashboard.modules.system.convert.dept; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostSimpleRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
| import org.mapstruct.Mapper; | ||||
| import org.mapstruct.factory.Mappers; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @Mapper | ||||
| public interface SysPostConvert { | ||||
|  | ||||
|     SysPostConvert INSTANCE = Mappers.getMapper(SysPostConvert.class); | ||||
|  | ||||
|     List<SysPostSimpleRespVO> convertList02(List<SysPostDO> list); | ||||
|  | ||||
| } | ||||
| @@ -1,7 +1,9 @@ | ||||
| package cn.iocoder.dashboard.modules.system.convert.user; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageItemRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysDeptDO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| @@ -21,4 +23,8 @@ public interface SysUserConvert { | ||||
|     @Mapping(source = "records", target = "list") | ||||
|     PageResult<SysUserDO> convertPage(IPage<SysUserDO> page); | ||||
|  | ||||
|     SysUserDO convert(SysUserCreateReqVO bean); | ||||
|  | ||||
|     SysUserDO convert(SysUserUpdateReqVO bean); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,19 @@ | ||||
| package cn.iocoder.dashboard.modules.system.dal.mysql.dao.dept; | ||||
|  | ||||
| import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| @Mapper | ||||
| public interface SysPostMapper extends BaseMapper<SysPostDO> { | ||||
|  | ||||
|     default List<SysPostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) { | ||||
|         return selectList(new QueryWrapperX<SysPostDO>().inIfPresent("id", ids) | ||||
|                 .inIfPresent("status", statuses)); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -18,6 +18,14 @@ public interface SysUserMapper extends BaseMapper<SysUserDO> { | ||||
|         return selectOne(new QueryWrapper<SysUserDO>().eq("username", username)); | ||||
|     } | ||||
|  | ||||
|     default SysUserDO selectByMobile(String mobile) { | ||||
|         return selectOne(new QueryWrapper<SysUserDO>().eq("mobile", mobile)); | ||||
|     } | ||||
|  | ||||
|     default SysUserDO selectByEmail(String email) { | ||||
|         return selectOne(new QueryWrapper<SysUserDO>().eq("email", email)); | ||||
|     } | ||||
|  | ||||
|     default IPage<SysUserDO> selectList(SysUserPageReqVO reqVO, List<Long> deptIds) { | ||||
|         return selectPage(MyBatisUtils.buildPage(reqVO), | ||||
|                 new QueryWrapperX<SysUserDO>().likeIfPresent("username", reqVO.getUsername()) | ||||
|   | ||||
| @@ -40,7 +40,7 @@ public class SysPostDO extends BaseDO { | ||||
|      * | ||||
|      * 枚举 {@link CommonStatusEnum} | ||||
|      */ | ||||
|     private String status; | ||||
|     private Integer status; | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|   | ||||
| @@ -19,7 +19,7 @@ import java.util.Set; | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  */ | ||||
| @TableName("sys_user") | ||||
| @TableName(value = "sys_user", autoResultMap = true) | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysUserDO extends BaseDO { | ||||
|   | ||||
| @@ -32,4 +32,23 @@ public interface SysErrorCodeConstants { | ||||
|     ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002003002, "已经存在编码为【{}}】的角色"); | ||||
|     ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002003004, "不能操作类型为系统内置的角色"); | ||||
|  | ||||
|     // ========== 用户模块 1002004000 ========== | ||||
|     ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1002004000, "用户账号已经存在"); | ||||
|     ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1002004001, "手机号已经存在"); | ||||
|     ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1002004002, "邮箱已经存在"); | ||||
|     ErrorCode USER_NOT_EXISTS = new ErrorCode(1002004003, "用户不存在"); | ||||
|  | ||||
|     // ========== 部门模块 1002005000 ========== | ||||
|     ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1002004001, "已经存在该名字的部门"); | ||||
|     ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1002004002,"父级部门不存在"); | ||||
|     ErrorCode DEPT_NOT_FOUND = new ErrorCode(1002004003, "当前部门不存在"); | ||||
|     ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004004, "存在子部门,无法删除"); | ||||
|     ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004005, "不能设置自己为父资源"); | ||||
|     ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004006, "部门中存在员工,无法删除"); | ||||
|     ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004007, "部门不处于开启状态,不允许选择"); | ||||
|  | ||||
|     // ========== 岗位模块 1002005000 ========== | ||||
|     ErrorCode POST_NOT_FOUND = new ErrorCode(1002005001, "当前岗位不存在"); | ||||
|     ErrorCode POST_NOT_ENABLE = new ErrorCode(1002005002, "岗位({}) 不处于开启状态,不允许选择"); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -50,4 +50,12 @@ public interface SysDeptService { | ||||
|      */ | ||||
|     List<SysDeptDO> listDeptsByParentIdFromCache(Long parentId, boolean recursive); | ||||
|  | ||||
|     /** | ||||
|      * 获得部门信息 | ||||
|      * | ||||
|      * @param id 部门编号 | ||||
|      * @return 部门信息 | ||||
|      */ | ||||
|     SysDeptDO getDept(Long id); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,25 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.dept; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 岗位 Service 接口 | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| public interface SysPostService { | ||||
|  | ||||
|     /** | ||||
|      * 获得所有岗位列表 | ||||
|      * | ||||
|      * @param ids 岗位编号数组。如果为空,不进行筛选 | ||||
|      * @param statuses 状态数组。如果为空,不进行筛选 | ||||
|      * @return 部门列表 | ||||
|      */ | ||||
|     List<SysPostDO> listPosts(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses); | ||||
|  | ||||
| } | ||||
| @@ -114,4 +114,9 @@ public class SysDeptServiceImpl implements SysDeptService { | ||||
|                 recursiveCount - 1, parentDeptMap)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public SysDeptDO getDept(Long id) { | ||||
|         return deptMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,28 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.dept.impl; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dao.dept.SysPostMapper; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
| import cn.iocoder.dashboard.modules.system.service.dept.SysPostService; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 岗位 Service 实现类 | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @Service | ||||
| public class SysPostServiceImpl implements SysPostService { | ||||
|  | ||||
|     @Resource | ||||
|     private SysPostMapper postMapper; | ||||
|  | ||||
|     @Override | ||||
|     public List<SysPostDO> listPosts(Collection<Long> ids, Collection<Integer> statuses) { | ||||
|         return postMapper.selectList(ids, statuses); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -170,55 +170,6 @@ public class SysMenuServiceImpl implements SysMenuService { | ||||
|         return menuMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
| //    /** | ||||
| //     * 获得菜单列表 | ||||
| //     * | ||||
| //     * @param menuIds 菜单编号列表 | ||||
| //     * @return 菜单列表 | ||||
| //     */ | ||||
| //    public List<ResourceBO> listResources(List<Integer> menuIds) { | ||||
| //        List<ResourceDO> menuDOs = menuMapper.selectBatchIds(menuIds); | ||||
| //        return ResourceConvert.INSTANCE.convertList(menuDOs); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 获得菜单全列表 | ||||
| //     * | ||||
| //     * @return 菜单全列表 | ||||
| //     */ | ||||
| //    public List<ResourceBO> listResources() { | ||||
| //        List<ResourceDO> menuDOs = menuMapper.selectList(null); | ||||
| //        return ResourceConvert.INSTANCE.convertList(menuDOs); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 获得指定类型的菜单列表 | ||||
| //     * | ||||
| //     * @param type 菜单类型,允许空 | ||||
| //     * @return 菜单列表 | ||||
| //     */ | ||||
| //    public List<ResourceBO> listResourcesByType(Integer type) { | ||||
| //        List<ResourceDO> menuDOs = menuMapper.selectListByType(type); | ||||
| //        return ResourceConvert.INSTANCE.convertList(menuDOs); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 获得角色拥有的菜单列表 | ||||
| //     * | ||||
| //     * @param roleIds 角色编号 | ||||
| //     * @param type 菜单类型,允许空 | ||||
| //     * @return 菜单列表 | ||||
| //     */ | ||||
| //    public List<ResourceBO> listRoleResourcesByType(Collection<Integer> roleIds, Integer type) { | ||||
| //        List<RoleResourceDO> roleResourceDOs = roleResourceMapper.selectListByRoleIds(roleIds); | ||||
| //        if (CollectionUtils.isEmpty(roleResourceDOs)) { | ||||
| //            return Collections.emptyList(); | ||||
| //        } | ||||
| //        List<ResourceDO> menuDOs = menuMapper.selectListByIdsAndType( | ||||
| //                CollectionUtils.convertSet(roleResourceDOs, RoleResourceDO::getResourceId), type); | ||||
| //        return ResourceConvert.INSTANCE.convertList(menuDOs); | ||||
| //    } | ||||
| // | ||||
|     /** | ||||
|      * 校验父菜单是否合法 | ||||
|      * | ||||
| @@ -263,7 +214,7 @@ public class SysMenuServiceImpl implements SysMenuService { | ||||
|         if (menu == null) { | ||||
|             return; | ||||
|         } | ||||
|         // 如果 menuId 为空,说明不用比较是否为相同 menuId 的菜单 | ||||
|         // 如果 id 为空,说明不用比较是否为相同 id 的菜单 | ||||
|         if (id == null) { | ||||
|             throw ServiceExceptionUtil.exception(MENU_NAME_DUPLICATE); | ||||
|         } | ||||
|   | ||||
| @@ -1,7 +1,9 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.user; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; | ||||
|  | ||||
| /** | ||||
| @@ -29,10 +31,10 @@ public interface SysUserService { | ||||
|     /** | ||||
|      * 通过用户 ID 查询用户 | ||||
|      * | ||||
|      * @param userId 用户ID | ||||
|      * @param id 用户ID | ||||
|      * @return 用户对象信息 | ||||
|      */ | ||||
|     SysUserDO getUser(Long userId); | ||||
|     SysUserDO getUser(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 获得用户分页列表 | ||||
| @@ -42,6 +44,21 @@ public interface SysUserService { | ||||
|      */ | ||||
|     PageResult<SysUserDO> pageUsers(SysUserPageReqVO reqVO); | ||||
|  | ||||
|     /** | ||||
|      * 创建用户 | ||||
|      * | ||||
|      * @param reqVO 用户信息 | ||||
|      * @return 用户编号 | ||||
|      */ | ||||
|     Long createUser(SysUserCreateReqVO reqVO); | ||||
|  | ||||
|     /** | ||||
|      * 修改用户 | ||||
|      * | ||||
|      * @param reqVO 用户信息 | ||||
|      */ | ||||
|     void updateUser(SysUserUpdateReqVO reqVO); | ||||
|  | ||||
| // | ||||
| //    /** | ||||
| //     * 根据用户ID查询用户所属角色组 | ||||
|   | ||||
| @@ -1,19 +1,32 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.user; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import cn.iocoder.dashboard.common.enums.CommonStatusEnum; | ||||
| import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.convert.user.SysUserConvert; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dao.user.SysUserMapper; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysDeptDO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysPostDO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; | ||||
| import cn.iocoder.dashboard.modules.system.service.dept.SysDeptService; | ||||
| import cn.iocoder.dashboard.modules.system.service.dept.SysPostService; | ||||
| import cn.iocoder.dashboard.util.collection.CollectionUtils; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.security.crypto.password.PasswordEncoder; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
|  | ||||
| import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*; | ||||
|  | ||||
|  | ||||
| /** | ||||
| @@ -30,16 +43,12 @@ public class SysUserServiceImpl implements SysUserService { | ||||
|  | ||||
|     @Resource | ||||
|     private SysDeptService deptService; | ||||
|     @Resource | ||||
|     private SysPostService postService; | ||||
|  | ||||
|     @Resource | ||||
|     private PasswordEncoder passwordEncoder; | ||||
|  | ||||
| //    @Autowired | ||||
| //    private SysUserMapper userMapper; | ||||
| // | ||||
| //    @Autowired | ||||
| //    private SysRoleMapper roleMapper; | ||||
| // | ||||
| //    @Autowired | ||||
| //    private SysPostMapper postMapper; | ||||
| // | ||||
| //    @Autowired | ||||
| //    private SysUserRoleMapper userRoleMapper; | ||||
| // | ||||
| @@ -68,8 +77,8 @@ public class SysUserServiceImpl implements SysUserService { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public SysUserDO getUser(Long userId) { | ||||
|         return userMapper.selectById(userId); | ||||
|     public SysUserDO getUser(Long id) { | ||||
|         return userMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -77,240 +86,148 @@ public class SysUserServiceImpl implements SysUserService { | ||||
|         // 处理部门查询条件 | ||||
|         List<Long> deptIds = Collections.emptyList(); | ||||
|         if (reqVO.getDeptId() != null) { | ||||
|             deptIds = CollectionUtils.convertList(deptService.listDeptsByParentIdFromCache(reqVO.getDeptId(), true), | ||||
|                     SysDeptDO::getId); | ||||
|             deptIds = CollectionUtils.convertList(deptService.listDeptsByParentIdFromCache( | ||||
|                     reqVO.getDeptId(), true), SysDeptDO::getId); | ||||
|             deptIds.add(reqVO.getDeptId()); | ||||
|         } | ||||
|         // 执行查询 | ||||
|         return SysUserConvert.INSTANCE.convertPage(userMapper.selectList(reqVO, deptIds)); | ||||
|     } | ||||
|  | ||||
| //    /** | ||||
| //     * 通过用户ID查询用户 | ||||
| //     * | ||||
| //     * @param userId 用户ID | ||||
| //     * @return 用户对象信息 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public SysUser selectUserById(Long userId) | ||||
| //    { | ||||
| //        return userMapper.selectUserById(userId); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 查询用户所属角色组 | ||||
| //     * | ||||
| //     * @param userName 用户名 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public String selectUserRoleGroup(String userName) | ||||
| //    { | ||||
| //        List<SysRole> list = roleMapper.selectRolesByUserName(userName); | ||||
| //        StringBuffer idsStr = new StringBuffer(); | ||||
| //        for (SysRole role : list) | ||||
| //        { | ||||
| //            idsStr.append(role.getRoleName()).append(","); | ||||
| //        } | ||||
| //        if (StringUtils.isNotEmpty(idsStr.toString())) | ||||
| //        { | ||||
| //            return idsStr.substring(0, idsStr.length() - 1); | ||||
| //        } | ||||
| //        return idsStr.toString(); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 查询用户所属岗位组 | ||||
| //     * | ||||
| //     * @param userName 用户名 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public String selectUserPostGroup(String userName) | ||||
| //    { | ||||
| //        List<SysPost> list = postMapper.selectPostsByUserName(userName); | ||||
| //        StringBuffer idsStr = new StringBuffer(); | ||||
| //        for (SysPost post : list) | ||||
| //        { | ||||
| //            idsStr.append(post.getPostName()).append(","); | ||||
| //        } | ||||
| //        if (StringUtils.isNotEmpty(idsStr.toString())) | ||||
| //        { | ||||
| //            return idsStr.substring(0, idsStr.length() - 1); | ||||
| //        } | ||||
| //        return idsStr.toString(); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 校验用户名称是否唯一 | ||||
| //     * | ||||
| //     * @param userName 用户名称 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public String checkUserNameUnique(String userName) | ||||
| //    { | ||||
| //        int count = userMapper.checkUserNameUnique(userName); | ||||
| //        if (count > 0) | ||||
| //        { | ||||
| //            return UserConstants.NOT_UNIQUE; | ||||
| //        } | ||||
| //        return UserConstants.UNIQUE; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 校验用户名称是否唯一 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public String checkPhoneUnique(SysUser user) | ||||
| //    { | ||||
| //        Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); | ||||
| //        SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); | ||||
| //        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) | ||||
| //        { | ||||
| //            return UserConstants.NOT_UNIQUE; | ||||
| //        } | ||||
| //        return UserConstants.UNIQUE; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 校验email是否唯一 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public String checkEmailUnique(SysUser user) | ||||
| //    { | ||||
| //        Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); | ||||
| //        SysUser info = userMapper.checkEmailUnique(user.getEmail()); | ||||
| //        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) | ||||
| //        { | ||||
| //            return UserConstants.NOT_UNIQUE; | ||||
| //        } | ||||
| //        return UserConstants.UNIQUE; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 校验用户是否允许操作 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public void checkUserAllowed(SysUser user) | ||||
| //    { | ||||
| //        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) | ||||
| //        { | ||||
| //            throw new CustomException("不允许操作超级管理员用户"); | ||||
| //        } | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 新增保存用户信息 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    @Transactional | ||||
| //    public int insertUser(SysUser user) | ||||
| //    { | ||||
| //        // 新增用户信息 | ||||
| //        int rows = userMapper.insertUser(user); | ||||
| //        // 新增用户岗位关联 | ||||
| //        insertUserPost(user); | ||||
| //        // 新增用户与角色管理 | ||||
| //        insertUserRole(user); | ||||
| //        return rows; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改保存用户信息 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    @Transactional | ||||
| //    public int updateUser(SysUser user) | ||||
| //    { | ||||
| //        Long userId = user.getUserId(); | ||||
| //        // 删除用户与角色关联 | ||||
| //        userRoleMapper.deleteUserRoleByUserId(userId); | ||||
| //        // 新增用户与角色管理 | ||||
| //        insertUserRole(user); | ||||
| //        // 删除用户与岗位关联 | ||||
| //        userPostMapper.deleteUserPostByUserId(userId); | ||||
| //        // 新增用户与岗位管理 | ||||
| //        insertUserPost(user); | ||||
| //        return userMapper.updateUser(user); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改用户状态 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public int updateUserStatus(SysUser user) | ||||
| //    { | ||||
| //        return userMapper.updateUser(user); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改用户基本信息 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public int updateUserProfile(SysUser user) | ||||
| //    { | ||||
| //        return userMapper.updateUser(user); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改用户头像 | ||||
| //     * | ||||
| //     * @param userName 用户名 | ||||
| //     * @param avatar 头像地址 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public boolean updateUserAvatar(String userName, String avatar) | ||||
| //    { | ||||
| //        return userMapper.updateUserAvatar(userName, avatar) > 0; | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 重置用户密码 | ||||
| //     * | ||||
| //     * @param user 用户信息 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public int resetPwd(SysUser user) | ||||
| //    { | ||||
| //        return userMapper.updateUser(user); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 重置用户密码 | ||||
| //     * | ||||
| //     * @param userName 用户名 | ||||
| //     * @param password 密码 | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    public int resetUserPwd(String userName, String password) | ||||
| //    { | ||||
| //        return userMapper.resetUserPwd(userName, password); | ||||
| //    } | ||||
| // | ||||
|     @Override | ||||
|     public Long createUser(SysUserCreateReqVO reqVO) { | ||||
|         // 校验正确性 | ||||
|         this.checkCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | ||||
|                 reqVO.getDeptId(), reqVO.getPostIds()); | ||||
|         // 插入用户 | ||||
|         SysUserDO user = SysUserConvert.INSTANCE.convert(reqVO); | ||||
|         user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启 | ||||
|         user.setPassword(passwordEncoder.encode(reqVO.getPassword())); // 加密密码 | ||||
|         userMapper.insert(user); | ||||
|         return user.getId(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void updateUser(SysUserUpdateReqVO reqVO) { | ||||
|         // 校验正确性 | ||||
|         this.checkCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | ||||
|                 reqVO.getDeptId(), reqVO.getPostIds()); | ||||
|         // 更新用户 | ||||
|         SysUserDO updateObj = SysUserConvert.INSTANCE.convert(reqVO); | ||||
|         userMapper.updateById(updateObj); | ||||
|     } | ||||
|  | ||||
|     private void checkCreateOrUpdate(Long id, String username, String mobile, String email, | ||||
|                                      Long deptId, Set<Long> postIds) { | ||||
|         // 校验用户存在 | ||||
|         this.checkUserExists(id); | ||||
|         // 校验用户名唯一 | ||||
|         this.checkUsernameUnique(id, username); | ||||
|         // 校验手机号唯一 | ||||
|         this.checkMobileUnique(id, mobile); | ||||
|         // 校验邮箱唯一 | ||||
|         this.checkEmailUnique(id, email); | ||||
|         // 校验部门处于开启状态 | ||||
|         this.checkDeptEnable(deptId); | ||||
|         // 校验岗位处于开启状态 | ||||
|         this.checkPostEnable(postIds); | ||||
|     } | ||||
|  | ||||
|     private void checkUserExists(Long id) { | ||||
|         if (id == null) { | ||||
|             return; | ||||
|         } | ||||
|         SysUserDO user = userMapper.selectById(id); | ||||
|         if (user == null) { | ||||
|             throw ServiceExceptionUtil.exception(USER_NOT_EXISTS); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkUsernameUnique(Long id, String username) { | ||||
|         if (StrUtil.isNotBlank(username)) { | ||||
|             return; | ||||
|         } | ||||
|         SysUserDO user = userMapper.selectByUsername(username); | ||||
|         if (user == null) { | ||||
|             return; | ||||
|         } | ||||
|         // 如果 id 为空,说明不用比较是否为相同 id 的用户 | ||||
|         if (id == null) { | ||||
|             throw ServiceExceptionUtil.exception(USER_USERNAME_EXISTS); | ||||
|         } | ||||
|         if (!user.getId().equals(id)) { | ||||
|             throw ServiceExceptionUtil.exception(USER_USERNAME_EXISTS); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkEmailUnique(Long id, String email) { | ||||
|         if (StrUtil.isNotBlank(email)) { | ||||
|             return; | ||||
|         } | ||||
|         SysUserDO user = userMapper.selectByEmail(email); | ||||
|         if (user == null) { | ||||
|             return; | ||||
|         } | ||||
|         // 如果 id 为空,说明不用比较是否为相同 id 的用户 | ||||
|         if (id == null) { | ||||
|             throw ServiceExceptionUtil.exception(USER_EMAIL_EXISTS); | ||||
|         } | ||||
|         if (!user.getId().equals(id)) { | ||||
|             throw ServiceExceptionUtil.exception(USER_EMAIL_EXISTS); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkMobileUnique(Long id, String email) { | ||||
|         if (StrUtil.isNotBlank(email)) { | ||||
|             return; | ||||
|         } | ||||
|         SysUserDO user = userMapper.selectByMobile(email); | ||||
|         if (user == null) { | ||||
|             return; | ||||
|         } | ||||
|         // 如果 id 为空,说明不用比较是否为相同 id 的用户 | ||||
|         if (id == null) { | ||||
|             throw ServiceExceptionUtil.exception(USER_MOBILE_EXISTS); | ||||
|         } | ||||
|         if (!user.getId().equals(id)) { | ||||
|             throw ServiceExceptionUtil.exception(USER_MOBILE_EXISTS); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkDeptEnable(Long deptId) { | ||||
|         if (deptId == null) { // 允许不选择 | ||||
|             return; | ||||
|         } | ||||
|         SysDeptDO dept = deptService.getDept(deptId); | ||||
|         if (dept == null) { | ||||
|             throw ServiceExceptionUtil.exception(DEPT_NOT_FOUND); | ||||
|         } | ||||
|         if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) { | ||||
|             throw ServiceExceptionUtil.exception(DEPT_NOT_ENABLE); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkPostEnable(Set<Long> postIds) { | ||||
|         if (CollUtil.isEmpty(postIds)) { // 允许不选择 | ||||
|             return; | ||||
|         } | ||||
|         List<SysPostDO> posts = postService.listPosts(postIds, null); | ||||
|         if (CollUtil.isEmpty(posts)) { | ||||
|             throw ServiceExceptionUtil.exception(POST_NOT_FOUND); | ||||
|         } | ||||
|         Map<Long, SysPostDO> postMap = CollectionUtils.convertMap(posts, SysPostDO::getId); | ||||
|         postIds.forEach(postId -> { | ||||
|             SysPostDO post = postMap.get(postId); | ||||
|             if (post == null) { | ||||
|                 throw ServiceExceptionUtil.exception(POST_NOT_FOUND); | ||||
|             } | ||||
|             if (!CommonStatusEnum.ENABLE.getStatus().equals(post.getStatus())) { | ||||
|                 throw ServiceExceptionUtil.exception(POST_NOT_ENABLE, post.getName()); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|  | ||||
| //    /** | ||||
| //     * 新增用户角色信息 | ||||
| //     * | ||||
| @@ -379,28 +296,8 @@ public class SysUserServiceImpl implements SysUserService { | ||||
| //        userPostMapper.deleteUserPostByUserId(userId); | ||||
| //        return userMapper.deleteUserById(userId); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 批量删除用户信息 | ||||
| //     * | ||||
| //     * @param userIds 需要删除的用户ID | ||||
| //     * @return 结果 | ||||
| //     */ | ||||
| //    @Override | ||||
| //    @Transactional | ||||
| //    public int deleteUserByIds(Long[] userIds) | ||||
| //    { | ||||
| //        for (Long userId : userIds) | ||||
| //        { | ||||
| //            checkUserAllowed(new SysUser(userId)); | ||||
| //        } | ||||
| //        // 删除用户与角色关联 | ||||
| //        userRoleMapper.deleteUserRole(userIds); | ||||
| //        // 删除用户与岗位关联 | ||||
| //        userPostMapper.deleteUserPost(userIds); | ||||
| //        return userMapper.deleteUserByIds(userIds); | ||||
| //    } | ||||
| // | ||||
|  | ||||
|  | ||||
| //    /** | ||||
| //     * 导入用户数据 | ||||
| //     * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV