update 优化 用户管理 只查询未禁用的部门角色岗位数据

feature/model
疯狂的狮子Li 1 year ago
parent ae0d4dd6e5
commit 49f20f7d9f

@ -7,6 +7,7 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.core.constant.UserConstants;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
@ -22,6 +23,8 @@ import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.common.tenant.helper.TenantHelper;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.bo.SysDeptBo; 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.bo.SysUserBo;
import org.dromara.system.domain.vo.*; import org.dromara.system.domain.vo.*;
import org.dromara.system.listener.SysUserImportListener; import org.dromara.system.listener.SysUserImportListener;
@ -124,9 +127,13 @@ public class SysUserController extends BaseController {
public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) { public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
SysUserInfoVo userInfoVo = new SysUserInfoVo(); 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.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
userInfoVo.setPosts(postService.selectPostAll()); userInfoVo.setPosts(postService.selectPostList(postBo));
if (ObjectUtil.isNotNull(userId)) { if (ObjectUtil.isNotNull(userId)) {
SysUserVo sysUser = userService.selectUserById(userId); SysUserVo sysUser = userService.selectUserById(userId);
userInfoVo.setUser(sysUser); userInfoVo.setUser(sysUser);

@ -69,6 +69,8 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
*/ */
@Override @Override
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) { public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
// 只查询未禁用部门
bo.setStatus(UserConstants.DEPT_NORMAL);
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
List<SysDeptVo> depts = baseMapper.selectDeptList(lqw); List<SysDeptVo> depts = baseMapper.selectDeptList(lqw);
return buildDeptTreeSelect(depts); return buildDeptTreeSelect(depts);

Loading…
Cancel
Save