mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-11-18 07:03:43 +08:00
Merge branch '5.X' into future/flowable
This commit is contained in:
@@ -92,9 +92,12 @@ public class SysDeptController extends BaseController {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(deptId)) {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||
return R.fail("该部门包含未停用的子部门!");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) {
|
||||
if (deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||
return R.fail("该部门包含未停用的子部门!");
|
||||
} else if (deptService.checkDeptExistUser(deptId)) {
|
||||
return R.fail("该部门下存在已分配用户,不能禁用!");
|
||||
}
|
||||
}
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.dromara.system.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
@@ -88,6 +89,9 @@ public class SysPostController extends BaseController {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
} else if (UserConstants.POST_DISABLE.equals(post.getStatus())
|
||||
&& postService.countUserPostById(post.getPostId()) > 0) {
|
||||
return R.fail("该岗位下存在已分配用户,不能禁用!");
|
||||
}
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
@@ -109,7 +113,9 @@ public class SysPostController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public R<List<SysPostVo>> optionselect() {
|
||||
List<SysPostVo> posts = postService.selectPostAll();
|
||||
SysPostBo postBo = new SysPostBo();
|
||||
postBo.setStatus(UserConstants.POST_NORMAL);
|
||||
List<SysPostVo> posts = postService.selectPostList(postBo);
|
||||
return R.ok(posts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
@@ -22,6 +24,8 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.bo.SysPostBo;
|
||||
import org.dromara.system.domain.bo.SysRoleBo;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.*;
|
||||
import org.dromara.system.listener.SysUserImportListener;
|
||||
@@ -124,9 +128,13 @@ public class SysUserController extends BaseController {
|
||||
public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
|
||||
userService.checkUserDataScope(userId);
|
||||
SysUserInfoVo userInfoVo = new SysUserInfoVo();
|
||||
List<SysRoleVo> roles = roleService.selectRoleAll();
|
||||
SysRoleBo roleBo = new SysRoleBo();
|
||||
roleBo.setStatus(UserConstants.ROLE_NORMAL);
|
||||
SysPostBo postBo = new SysPostBo();
|
||||
postBo.setStatus(UserConstants.POST_NORMAL);
|
||||
List<SysRoleVo> roles = roleService.selectRoleList(roleBo);
|
||||
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
|
||||
userInfoVo.setPosts(postService.selectPostAll());
|
||||
userInfoVo.setPosts(postService.selectPostList(postBo));
|
||||
if (ObjectUtil.isNotNull(userId)) {
|
||||
SysUserVo sysUser = userService.selectUserById(userId);
|
||||
userInfoVo.setUser(sysUser);
|
||||
@@ -258,4 +266,12 @@ public class SysUserController extends BaseController {
|
||||
return R.ok(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下的所有用户信息
|
||||
*/
|
||||
@SaCheckPermission("system:user:list")
|
||||
@GetMapping("/list/dept/{deptId}")
|
||||
public R<List<SysUserVo>> listByDept(@PathVariable @NotNull Long deptId) {
|
||||
return R.ok(userService.selectUserListByDept(deptId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SysDept extends TenantEntity {
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String leader;
|
||||
private Long leader;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
|
||||
@@ -59,11 +59,6 @@ public class SysDictData extends TenantEntity {
|
||||
*/
|
||||
private String isDefault;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -33,11 +33,6 @@ public class SysDictType extends TenantEntity {
|
||||
*/
|
||||
private String dictType;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SysDeptBo extends BaseEntity {
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String leader;
|
||||
private Long leader;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
|
||||
@@ -70,11 +70,6 @@ public class SysDictDataBo extends BaseEntity {
|
||||
*/
|
||||
private String isDefault;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
|
||||
@@ -44,11 +44,6 @@ public class SysDictTypeBo extends BaseEntity {
|
||||
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
|
||||
private String dictType;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SysClientVo implements Serializable {
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 7, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SysConfigVo implements Serializable {
|
||||
/**
|
||||
* 系统内置(Y是 N否)
|
||||
*/
|
||||
@ExcelProperty(value = "系统内置", index = 4, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||
private String configType;
|
||||
|
||||
|
||||
@@ -57,11 +57,16 @@ public class SysDeptVo implements Serializable {
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 负责人ID
|
||||
*/
|
||||
private Long leader;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ExcelProperty(value = "负责人")
|
||||
private String leader;
|
||||
private String leaderName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@@ -78,7 +83,7 @@ public class SysDeptVo implements Serializable {
|
||||
/**
|
||||
* 部门状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "部门状态", index = 5, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "部门状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -69,17 +69,10 @@ public class SysDictDataVo implements Serializable {
|
||||
/**
|
||||
* 是否默认(Y是 N否)
|
||||
*/
|
||||
@ExcelProperty(value = "是否默认", index = 5, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||
private String isDefault;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 6, converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -44,13 +44,6 @@ public class SysDictTypeVo implements Serializable {
|
||||
@ExcelProperty(value = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 3, converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SysLogininforVo implements Serializable {
|
||||
/**
|
||||
* 登录状态(0成功 1失败)
|
||||
*/
|
||||
@ExcelProperty(value = "登录状态", index = 2, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "登录状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_common_status")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SysOperLogVo implements Serializable {
|
||||
/**
|
||||
* 业务类型(0其它 1新增 2修改 3删除)
|
||||
*/
|
||||
@ExcelProperty(value = "业务类型", index = 2, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_oper_type")
|
||||
private Integer businessType;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SysOperLogVo implements Serializable {
|
||||
/**
|
||||
* 操作类别(0其它 1后台用户 2手机端用户)
|
||||
*/
|
||||
@ExcelProperty(value = "操作类别", index = 5, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "操作类别", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户")
|
||||
private Integer operatorType;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class SysOperLogVo implements Serializable {
|
||||
/**
|
||||
* 操作状态(0正常 1异常)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 13, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_common_status")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SysPostVo implements Serializable {
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 4, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SysRoleVo implements Serializable {
|
||||
/**
|
||||
* 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
|
||||
*/
|
||||
@ExcelProperty(value = "数据范围", index = 4, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||
private String dataScope;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class SysRoleVo implements Serializable {
|
||||
/**
|
||||
* 角色状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "角色状态", index = 7, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SysTenantPackageVo implements Serializable {
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", index = 5, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SysTenantVo implements Serializable {
|
||||
/**
|
||||
* 租户状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "租户状态", index = 13, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "租户状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -59,14 +59,14 @@ public class SysUserExportVo implements Serializable {
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@ExcelProperty(value = "用户性别", index = 6, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_user_sex")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "帐号状态", index = 7, converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
@@ -92,8 +92,8 @@ public class SysUserExportVo implements Serializable {
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ReverseAutoMapping(target = "leader", source = "dept.leader")
|
||||
@ReverseAutoMapping(target = "leaderName", source = "dept.leaderName")
|
||||
@ExcelProperty(value = "部门负责人")
|
||||
private String leader;
|
||||
private String leaderName;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.system.domain.SysDictData;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysDictData;
|
||||
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,7 +17,6 @@ public interface SysDictDataMapper extends BaseMapperPlus<SysDictData, SysDictDa
|
||||
default List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||
return selectVoList(
|
||||
new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(SysDictData::getStatus, UserConstants.DICT_NORMAL)
|
||||
.eq(SysDictData::getDictType, dictType)
|
||||
.orderByAsc(SysDictData::getDictSort));
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ public interface ISysSocialService {
|
||||
*/
|
||||
Boolean insertByBo(SysSocialBo bo);
|
||||
|
||||
/**
|
||||
* 更新社会化关系
|
||||
*/
|
||||
Boolean updateByBo(SysSocialBo bo);
|
||||
|
||||
/**
|
||||
* 删除社会化关系信息
|
||||
|
||||
@@ -202,4 +202,11 @@ public interface ISysUserService {
|
||||
*/
|
||||
int deleteUserByIds(Long[] userIds);
|
||||
|
||||
/**
|
||||
* 通过部门id查询当前部门所有用户
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
List<SysUserVo> selectUserListByDept(Long deptId);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
|
||||
// 只查询未禁用部门
|
||||
bo.setStatus(UserConstants.DEPT_NORMAL);
|
||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||
List<SysDeptVo> depts = baseMapper.selectDeptList(lqw);
|
||||
return buildDeptTreeSelect(depts);
|
||||
|
||||
@@ -56,7 +56,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
lqw.eq(bo.getDictSort() != null, SysDictData::getDictSort, bo.getDictSort());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictLabel()), SysDictData::getDictLabel, bo.getDictLabel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDictType()), SysDictData::getDictType, bo.getDictType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictData::getStatus, bo.getStatus());
|
||||
lqw.orderByAsc(SysDictData::getDictSort);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
LambdaQueryWrapper<SysDictType> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictName()), SysDictType::getDictName, bo.getDictName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictType()), SysDictType::getDictType, bo.getDictType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictType::getStatus, bo.getStatus());
|
||||
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
return lqw;
|
||||
|
||||
@@ -156,7 +156,7 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
for (Long postId : postIds) {
|
||||
SysPost post = baseMapper.selectById(postId);
|
||||
if (countUserPostById(postId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除!", post.getPostName()));
|
||||
}
|
||||
}
|
||||
return baseMapper.deleteBatchIds(Arrays.asList(postIds));
|
||||
|
||||
@@ -283,6 +283,9 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
*/
|
||||
@Override
|
||||
public int updateRoleStatus(Long roleId, String status) {
|
||||
if (UserConstants.ROLE_DISABLE.equals(status) && this.countUserRoleByRoleId(roleId) > 0) {
|
||||
throw new ServiceException("角色已分配,不能禁用!");
|
||||
}
|
||||
return baseMapper.update(null,
|
||||
new LambdaUpdateWrapper<SysRole>()
|
||||
.set(SysRole::getStatus, status)
|
||||
@@ -379,7 +382,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
checkRoleAllowed(BeanUtil.toBean(role, SysRoleBo.class));
|
||||
checkRoleDataScope(roleId);
|
||||
if (countUserRoleByRoleId(roleId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除!", role.getRoleName()));
|
||||
}
|
||||
}
|
||||
List<Long> ids = Arrays.asList(roleIds);
|
||||
|
||||
@@ -65,6 +65,15 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新社会化关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SysSocialBo bo) {
|
||||
SysSocial update = MapstructUtils.convert(bo, SysSocial.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
|
||||
@@ -132,7 +132,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
SysDept dept = new SysDept();
|
||||
dept.setTenantId(tenantId);
|
||||
dept.setDeptName(bo.getCompanyName());
|
||||
dept.setLeader(bo.getUsername());
|
||||
dept.setParentId(Constants.TOP_PARENT_ID);
|
||||
dept.setAncestors(Constants.TOP_PARENT_ID.toString());
|
||||
deptMapper.insert(dept);
|
||||
@@ -152,6 +151,11 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
user.setPassword(BCrypt.hashpw(bo.getPassword()));
|
||||
user.setDeptId(deptId);
|
||||
userMapper.insert(user);
|
||||
//新增系统用户后,默认当前用户为部门的负责人
|
||||
SysDept sd = new SysDept();
|
||||
sd.setLeader(user.getUserId());
|
||||
sd.setDeptId(deptId);
|
||||
deptMapper.updateById(sd);
|
||||
|
||||
// 用户和角色关联表
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
|
||||
@@ -513,6 +513,19 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过部门id查询当前部门所有用户
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserVo> selectUserListByDept(Long deptId) {
|
||||
LambdaQueryWrapper<SysUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SysUser::getDeptId, deptId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = CacheNames.SYS_USER_NAME, key = "#userId")
|
||||
@Override
|
||||
public String selectUserNameById(Long userId) {
|
||||
|
||||
@@ -67,17 +67,21 @@
|
||||
|
||||
<select id="selectPageUserList" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_name, d.leader, u1.user_name as leaderName
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user u1 on u1.user_id = d.leader
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectUserList" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_name, d.leader, u1.user_name as leaderName
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user u1 on u1.user_id = d.leader
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user