完成用户的添加和修改的逻辑

This commit is contained in:
YunaiV 2021-01-10 22:51:13 +08:00
parent 855327de1a
commit e3884ee57f
22 changed files with 479 additions and 449 deletions

View File

@ -9,6 +9,14 @@ export function listPost(query) {
}) })
} }
// 获取岗位精简信息列表
export function listSimplePosts() {
return request({
url: '/system/post/list-all-simple',
method: 'get'
})
}
// 查询岗位详细 // 查询岗位详细
export function getPost(postId) { export function getPost(postId) {
return request({ return request({

View File

@ -31,7 +31,7 @@ export function addUser(data) {
export function updateUser(data) { export function updateUser(data) {
return request({ return request({
url: '/system/user/update', url: '/system/user/update',
method: 'put', method: 'post',
data: data data: data
}) })
} }

View File

@ -10,6 +10,7 @@ export const DICT_TYPE = {
SYS_MENU_TYPE: 'sys_menu_type', SYS_MENU_TYPE: 'sys_menu_type',
SYS_ROLE_TYPE: 'sys_role_type', SYS_ROLE_TYPE: 'sys_role_type',
SYS_DATA_SCOPE: 'sys_data_scope', SYS_DATA_SCOPE: 'sys_data_scope',
SYS_USER_SEX: 'sys_user_sex',
} }
/** /**

View File

@ -188,7 +188,9 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" /> <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true"
placeholder="请选择归属部门" :normalizer="normalizer"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -221,49 +223,22 @@
<el-form-item label="用户性别"> <el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择"> <el-select v-model="form.sex" placeholder="请选择">
<el-option <el-option
v-for="dict in sexOptions" v-for="dict in sexDictDatas"
:key="dict.dictValue" :key="parseInt(dict.value)"
:label="dict.dictLabel" :label="dict.label"
:value="dict.dictValue" :value="parseInt(dict.value)"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{dict.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="岗位"> <el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择"> <el-select v-model="form.postIds" multiple placeholder="请选择">
<el-option <el-option
v-for="item in postOptions" v-for="item in postOptions"
:key="item.postId" :key="item.id"
:label="item.postName" :label="item.name"
:value="item.postId" :value="item.id"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
:disabled="item.status == 1"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -313,17 +288,45 @@
<el-button @click="upload.open = false"> </el-button> <el-button @click="upload.open = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 分配角色 -->
<!-- <el-dialog title="分配角色" :visible.sync="openMenu" width="500px" append-to-body>-->
<!-- <el-form :model="form" label-width="80px">-->
<!-- <el-form-item label="用户名称">-->
<!-- <el-input v-model="form.username" :disabled="true" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="用户昵称">-->
<!-- <el-input v-model="form.nickname" :disabled="true" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="角色">-->
<!-- <el-select v-model="form.roleIds" multiple placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in roleOptions"-->
<!-- :key="item.roleId"-->
<!-- :label="item.roleName"-->
<!-- :value="item.roleId"-->
<!-- :disabled="item.status == 1"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="submitMenu"> </el-button>-->
<!-- <el-button @click="cancelMenu"> </el-button>-->
<!-- </div>-->
<!-- </el-dialog>-->
</div> </div>
</template> </template>
<script> <script>
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user"; import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listSimpleDepts} from "@/api/system/dept"; import {listSimpleDepts} from "@/api/system/dept";
import {listSimplePosts} from "@/api/system/post";
import {SysCommonStatusEnum} from "@/utils/constants"; import {SysCommonStatusEnum} from "@/utils/constants";
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import {DICT_TYPE, getDictDatas} from "@/utils/dict";
@ -422,6 +425,7 @@ export default {
SysCommonStatusEnum: SysCommonStatusEnum, SysCommonStatusEnum: SysCommonStatusEnum,
// //
statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS), statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS),
sexDictDatas: getDictDatas(DICT_TYPE.SYS_USER_SEX),
}; };
}, },
watch: { watch: {
@ -446,18 +450,23 @@ export default {
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
])).then(response => { ])).then(response => {
this.userList = response.data.list; this.userList = response.data.list;
this.total = response.data.list; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 + 岗位下拉 */
getTreeselect() { getTreeselect() {
listSimpleDepts().then(response => { listSimpleDepts().then(response => {
// menuOptions // deptOptions
this.deptOptions = []; this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, "id")); this.deptOptions.push(...this.handleTree(response.data, "id"));
}); });
listSimplePosts().then(response => {
// postOptions
this.postOptions = [];
this.postOptions.push(...response.data);
});
}, },
// //
filterNode(value, data) { filterNode(value, data) {
@ -521,14 +530,12 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
//
this.getTreeselect(); this.getTreeselect();
getUser().then(response => { //
this.postOptions = response.posts; this.open = true;
this.roleOptions = response.roles; this.title = "添加用户";
this.open = true; this.form.password = this.initPassword;
this.title = "添加用户";
this.form.password = this.initPassword;
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -537,10 +544,6 @@ export default {
const id = row.id; const id = row.id;
getUser(id).then(response => { getUser(id).then(response => {
this.form = response.data; this.form = response.data;
this.postOptions = response.posts;
this.roleOptions = response.roles;
this.form.postIds = response.postIds;
this.form.roleIds = response.roleIds;
this.open = true; this.open = true;
this.title = "修改用户"; this.title = "修改用户";
this.form.password = ""; this.form.password = "";
@ -561,7 +564,7 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != undefined) { if (this.form.id !== undefined) {
updateUser(this.form).then(response => { updateUser(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -630,6 +633,14 @@ export default {
// //
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.$refs.upload.submit();
},
//
normalizer(node) {
return {
id: node.id,
label: node.name,
children: node.children
}
} }
} }
}; };

View File

@ -26,13 +26,13 @@ import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
public class SysDeptController { public class SysDeptController {
@Resource @Resource
private SysDeptService sysDeptService; private SysDeptService deptService;
@ApiOperation("获取部门列表") @ApiOperation("获取部门列表")
// @PreAuthorize("@ss.hasPermi('system:dept:list')") // @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
public CommonResult<List<SysDeptRespVO>> listDepts(SysDeptListReqVO reqVO) { 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)); list.sort(Comparator.comparing(SysDeptDO::getSort));
return success(SysDeptConvert.INSTANCE.convertList(list)); return success(SysDeptConvert.INSTANCE.convertList(list));
} }
@ -43,8 +43,8 @@ public class SysDeptController {
// 获得部门列表只要开启状态的 // 获得部门列表只要开启状态的
SysDeptListReqVO reqVO = new SysDeptListReqVO(); SysDeptListReqVO reqVO = new SysDeptListReqVO();
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
List<SysDeptDO> list = sysDeptService.listDepts(reqVO); List<SysDeptDO> list = deptService.listDepts(reqVO);
// 排序后返回个诶前端 // 排序后返回前端
list.sort(Comparator.comparing(SysDeptDO::getSort)); list.sort(Comparator.comparing(SysDeptDO::getSort));
return success(SysDeptConvert.INSTANCE.convertList02(list)); return success(SysDeptConvert.INSTANCE.convertList02(list));
} }

View File

@ -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));
}
}

View File

@ -3,8 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.user;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.*;
import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserPageReqVO;
import cn.iocoder.dashboard.modules.system.convert.user.SysUserConvert; 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.dept.SysDeptDO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; 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.modules.system.service.user.SysUserService;
import cn.iocoder.dashboard.util.collection.CollectionUtils; import cn.iocoder.dashboard.util.collection.CollectionUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
@ -59,7 +58,36 @@ public class SysUserController {
}); });
return success(new PageResult<>(userList, pageResult.getTotal())); 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) // @Log(title = "用户管理", businessType = BusinessType.EXPORT)
// @PreAuthorize("@ss.hasPermi('system:user:export')") // @PreAuthorize("@ss.hasPermi('system:user:export')")
// @GetMapping("/export") // @GetMapping("/export")
@ -90,76 +118,8 @@ public class SysUserController {
// return util.importTemplateExcel("用户数据"); // 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));
// }
//
// /** // /**
// * 删除用户 // * 删除用户
// */ // */

View File

@ -2,11 +2,21 @@ package cn.iocoder.dashboard.modules.system.controller.user.vo.user;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
@ApiModel("用户创建 Request VO") @ApiModel("用户创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysUserCreateReqVO extends SysUserBaseVO { public class SysUserCreateReqVO extends SysUserBaseVO {
@ApiModelProperty(value = "密码", required = true, example = "123456")
@NotEmpty(message = "密码不能为空")
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
private String password;
} }

View File

@ -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);
}

View File

@ -1,7 +1,9 @@
package cn.iocoder.dashboard.modules.system.convert.user; package cn.iocoder.dashboard.modules.system.convert.user;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.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.dept.SysDeptDO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -21,4 +23,8 @@ public interface SysUserConvert {
@Mapping(source = "records", target = "list") @Mapping(source = "records", target = "list")
PageResult<SysUserDO> convertPage(IPage<SysUserDO> page); PageResult<SysUserDO> convertPage(IPage<SysUserDO> page);
SysUserDO convert(SysUserCreateReqVO bean);
SysUserDO convert(SysUserUpdateReqVO bean);
} }

View File

@ -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));
}
}

View File

@ -18,6 +18,14 @@ public interface SysUserMapper extends BaseMapper<SysUserDO> {
return selectOne(new QueryWrapper<SysUserDO>().eq("username", username)); 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) { default IPage<SysUserDO> selectList(SysUserPageReqVO reqVO, List<Long> deptIds) {
return selectPage(MyBatisUtils.buildPage(reqVO), return selectPage(MyBatisUtils.buildPage(reqVO),
new QueryWrapperX<SysUserDO>().likeIfPresent("username", reqVO.getUsername()) new QueryWrapperX<SysUserDO>().likeIfPresent("username", reqVO.getUsername())

View File

@ -40,7 +40,7 @@ public class SysPostDO extends BaseDO {
* *
* 枚举 {@link CommonStatusEnum} * 枚举 {@link CommonStatusEnum}
*/ */
private String status; private Integer status;
/** /**
* 备注 * 备注
*/ */

View File

@ -19,7 +19,7 @@ import java.util.Set;
* *
* @author ruoyi * @author ruoyi
*/ */
@TableName("sys_user") @TableName(value = "sys_user", autoResultMap = true)
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysUserDO extends BaseDO { public class SysUserDO extends BaseDO {

View File

@ -32,4 +32,23 @@ public interface SysErrorCodeConstants {
ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002003002, "已经存在编码为【{}}】的角色"); ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002003002, "已经存在编码为【{}}】的角色");
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002003004, "不能操作类型为系统内置的角色"); 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, "岗位({}) 不处于开启状态,不允许选择");
} }

View File

@ -50,4 +50,12 @@ public interface SysDeptService {
*/ */
List<SysDeptDO> listDeptsByParentIdFromCache(Long parentId, boolean recursive); List<SysDeptDO> listDeptsByParentIdFromCache(Long parentId, boolean recursive);
/**
* 获得部门信息
*
* @param id 部门编号
* @return 部门信息
*/
SysDeptDO getDept(Long id);
} }

View File

@ -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);
}

View File

@ -114,4 +114,9 @@ public class SysDeptServiceImpl implements SysDeptService {
recursiveCount - 1, parentDeptMap)); recursiveCount - 1, parentDeptMap));
} }
@Override
public SysDeptDO getDept(Long id) {
return deptMapper.selectById(id);
}
} }

View File

@ -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);
}
}

View File

@ -170,55 +170,6 @@ public class SysMenuServiceImpl implements SysMenuService {
return menuMapper.selectById(id); 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) { if (menu == null) {
return; return;
} }
// 如果 menuId 为空说明不用比较是否为相同 menuId 的菜单 // 如果 id 为空说明不用比较是否为相同 id 的菜单
if (id == null) { if (id == null) {
throw ServiceExceptionUtil.exception(MENU_NAME_DUPLICATE); throw ServiceExceptionUtil.exception(MENU_NAME_DUPLICATE);
} }

View File

@ -1,7 +1,9 @@
package cn.iocoder.dashboard.modules.system.service.user; package cn.iocoder.dashboard.modules.system.service.user;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.SysUserPageReqVO;
import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO;
/** /**
@ -29,10 +31,10 @@ public interface SysUserService {
/** /**
* 通过用户 ID 查询用户 * 通过用户 ID 查询用户
* *
* @param userId 用户ID * @param id 用户ID
* @return 用户对象信息 * @return 用户对象信息
*/ */
SysUserDO getUser(Long userId); SysUserDO getUser(Long id);
/** /**
* 获得用户分页列表 * 获得用户分页列表
@ -42,6 +44,21 @@ public interface SysUserService {
*/ */
PageResult<SysUserDO> pageUsers(SysUserPageReqVO reqVO); PageResult<SysUserDO> pageUsers(SysUserPageReqVO reqVO);
/**
* 创建用户
*
* @param reqVO 用户信息
* @return 用户编号
*/
Long createUser(SysUserCreateReqVO reqVO);
/**
* 修改用户
*
* @param reqVO 用户信息
*/
void updateUser(SysUserUpdateReqVO reqVO);
// //
// /** // /**
// * 根据用户ID查询用户所属角色组 // * 根据用户ID查询用户所属角色组

View File

@ -1,19 +1,32 @@
package cn.iocoder.dashboard.modules.system.service.user; 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.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.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.convert.user.SysUserConvert;
import cn.iocoder.dashboard.modules.system.dal.mysql.dao.user.SysUserMapper; 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.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.dal.mysql.dataobject.user.SysUserDO;
import cn.iocoder.dashboard.modules.system.service.dept.SysDeptService; 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 cn.iocoder.dashboard.util.collection.CollectionUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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 @Resource
private SysDeptService deptService; private SysDeptService deptService;
@Resource
private SysPostService postService;
@Resource
private PasswordEncoder passwordEncoder;
// @Autowired
// private SysUserMapper userMapper;
//
// @Autowired
// private SysRoleMapper roleMapper;
//
// @Autowired
// private SysPostMapper postMapper;
//
// @Autowired // @Autowired
// private SysUserRoleMapper userRoleMapper; // private SysUserRoleMapper userRoleMapper;
// //
@ -68,8 +77,8 @@ public class SysUserServiceImpl implements SysUserService {
} }
@Override @Override
public SysUserDO getUser(Long userId) { public SysUserDO getUser(Long id) {
return userMapper.selectById(userId); return userMapper.selectById(id);
} }
@Override @Override
@ -77,240 +86,148 @@ public class SysUserServiceImpl implements SysUserService {
// 处理部门查询条件 // 处理部门查询条件
List<Long> deptIds = Collections.emptyList(); List<Long> deptIds = Collections.emptyList();
if (reqVO.getDeptId() != null) { if (reqVO.getDeptId() != null) {
deptIds = CollectionUtils.convertList(deptService.listDeptsByParentIdFromCache(reqVO.getDeptId(), true), deptIds = CollectionUtils.convertList(deptService.listDeptsByParentIdFromCache(
SysDeptDO::getId); reqVO.getDeptId(), true), SysDeptDO::getId);
deptIds.add(reqVO.getDeptId()); deptIds.add(reqVO.getDeptId());
} }
// 执行查询 // 执行查询
return SysUserConvert.INSTANCE.convertPage(userMapper.selectList(reqVO, deptIds)); return SysUserConvert.INSTANCE.convertPage(userMapper.selectList(reqVO, deptIds));
} }
// /** @Override
// * 通过用户ID查询用户 public Long createUser(SysUserCreateReqVO reqVO) {
// * // 校验正确性
// * @param userId 用户ID this.checkCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
// * @return 用户对象信息 reqVO.getDeptId(), reqVO.getPostIds());
// */ // 插入用户
// @Override SysUserDO user = SysUserConvert.INSTANCE.convert(reqVO);
// public SysUser selectUserById(Long userId) user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
// { user.setPassword(passwordEncoder.encode(reqVO.getPassword())); // 加密密码
// return userMapper.selectUserById(userId); userMapper.insert(user);
// } return user.getId();
// }
// /**
// * 查询用户所属角色组 @Override
// * public void updateUser(SysUserUpdateReqVO reqVO) {
// * @param userName 用户名 // 校验正确性
// * @return 结果 this.checkCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
// */ reqVO.getDeptId(), reqVO.getPostIds());
// @Override // 更新用户
// public String selectUserRoleGroup(String userName) SysUserDO updateObj = SysUserConvert.INSTANCE.convert(reqVO);
// { userMapper.updateById(updateObj);
// List<SysRole> list = roleMapper.selectRolesByUserName(userName); }
// StringBuffer idsStr = new StringBuffer();
// for (SysRole role : list) private void checkCreateOrUpdate(Long id, String username, String mobile, String email,
// { Long deptId, Set<Long> postIds) {
// idsStr.append(role.getRoleName()).append(","); // 校验用户存在
// } this.checkUserExists(id);
// if (StringUtils.isNotEmpty(idsStr.toString())) // 校验用户名唯一
// { this.checkUsernameUnique(id, username);
// return idsStr.substring(0, idsStr.length() - 1); // 校验手机号唯一
// } this.checkMobileUnique(id, mobile);
// return idsStr.toString(); // 校验邮箱唯一
// } this.checkEmailUnique(id, email);
// // 校验部门处于开启状态
// /** this.checkDeptEnable(deptId);
// * 查询用户所属岗位组 // 校验岗位处于开启状态
// * this.checkPostEnable(postIds);
// * @param userName 用户名 }
// * @return 结果
// */ private void checkUserExists(Long id) {
// @Override if (id == null) {
// public String selectUserPostGroup(String userName) return;
// { }
// List<SysPost> list = postMapper.selectPostsByUserName(userName); SysUserDO user = userMapper.selectById(id);
// StringBuffer idsStr = new StringBuffer(); if (user == null) {
// for (SysPost post : list) throw ServiceExceptionUtil.exception(USER_NOT_EXISTS);
// { }
// idsStr.append(post.getPostName()).append(","); }
// }
// if (StringUtils.isNotEmpty(idsStr.toString())) private void checkUsernameUnique(Long id, String username) {
// { if (StrUtil.isNotBlank(username)) {
// return idsStr.substring(0, idsStr.length() - 1); return;
// } }
// return idsStr.toString(); SysUserDO user = userMapper.selectByUsername(username);
// } if (user == null) {
// return;
// /** }
// * 校验用户名称是否唯一 // 如果 id 为空说明不用比较是否为相同 id 的用户
// * if (id == null) {
// * @param userName 用户名称 throw ServiceExceptionUtil.exception(USER_USERNAME_EXISTS);
// * @return 结果 }
// */ if (!user.getId().equals(id)) {
// @Override throw ServiceExceptionUtil.exception(USER_USERNAME_EXISTS);
// public String checkUserNameUnique(String userName) }
// { }
// int count = userMapper.checkUserNameUnique(userName);
// if (count > 0) private void checkEmailUnique(Long id, String email) {
// { if (StrUtil.isNotBlank(email)) {
// return UserConstants.NOT_UNIQUE; return;
// } }
// return UserConstants.UNIQUE; SysUserDO user = userMapper.selectByEmail(email);
// } if (user == null) {
// return;
// /** }
// * 校验用户名称是否唯一 // 如果 id 为空说明不用比较是否为相同 id 的用户
// * if (id == null) {
// * @param user 用户信息 throw ServiceExceptionUtil.exception(USER_EMAIL_EXISTS);
// * @return }
// */ if (!user.getId().equals(id)) {
// @Override throw ServiceExceptionUtil.exception(USER_EMAIL_EXISTS);
// public String checkPhoneUnique(SysUser user) }
// { }
// Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
// SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); private void checkMobileUnique(Long id, String email) {
// if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) if (StrUtil.isNotBlank(email)) {
// { return;
// return UserConstants.NOT_UNIQUE; }
// } SysUserDO user = userMapper.selectByMobile(email);
// return UserConstants.UNIQUE; if (user == null) {
// } return;
// }
// /** // 如果 id 为空说明不用比较是否为相同 id 的用户
// * 校验email是否唯一 if (id == null) {
// * throw ServiceExceptionUtil.exception(USER_MOBILE_EXISTS);
// * @param user 用户信息 }
// * @return if (!user.getId().equals(id)) {
// */ throw ServiceExceptionUtil.exception(USER_MOBILE_EXISTS);
// @Override }
// public String checkEmailUnique(SysUser user) }
// {
// Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); private void checkDeptEnable(Long deptId) {
// SysUser info = userMapper.checkEmailUnique(user.getEmail()); if (deptId == null) { // 允许不选择
// if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) return;
// { }
// return UserConstants.NOT_UNIQUE; SysDeptDO dept = deptService.getDept(deptId);
// } if (dept == null) {
// return UserConstants.UNIQUE; throw ServiceExceptionUtil.exception(DEPT_NOT_FOUND);
// } }
// if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) {
// /** throw ServiceExceptionUtil.exception(DEPT_NOT_ENABLE);
// * 校验用户是否允许操作 }
// * }
// * @param user 用户信息
// */ private void checkPostEnable(Set<Long> postIds) {
// @Override if (CollUtil.isEmpty(postIds)) { // 允许不选择
// public void checkUserAllowed(SysUser user) return;
// { }
// if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) List<SysPostDO> posts = postService.listPosts(postIds, null);
// { if (CollUtil.isEmpty(posts)) {
// throw new CustomException("不允许操作超级管理员用户"); 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);
// * @param user 用户信息 }
// * @return 结果 if (!CommonStatusEnum.ENABLE.getStatus().equals(post.getStatus())) {
// */ throw ServiceExceptionUtil.exception(POST_NOT_ENABLE, post.getName());
// @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);
// }
//
// /** // /**
// * 新增用户角色信息 // * 新增用户角色信息
// * // *
@ -379,28 +296,8 @@ public class SysUserServiceImpl implements SysUserService {
// userPostMapper.deleteUserPostByUserId(userId); // userPostMapper.deleteUserPostByUserId(userId);
// return userMapper.deleteUserById(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);
// }
//
// /** // /**
// * 导入用户数据 // * 导入用户数据
// * // *