[fix]部门和用户下拉列表权限
This commit is contained in:
parent
585359d2bd
commit
9f9edf8cef
@ -252,11 +252,19 @@ public class SysUserController extends BaseController {
|
||||
return R.ok(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@GetMapping("/deptTreeOption")
|
||||
public R<List<Tree<Long>>> deptTreeOption() {
|
||||
return R.ok(deptService.selectDeptTreeOption());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@GetMapping("/optionsSelect")
|
||||
public R<List<SysUser>> userOptions() {
|
||||
return R.ok(userService.selectUserList(new SysUser()));
|
||||
return R.ok(userService.selectUserOptions());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.eqc.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.eqc.common.annotation.DataColumn;
|
||||
import com.eqc.common.annotation.DataPermission;
|
||||
@ -37,4 +38,12 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, Sy
|
||||
*/
|
||||
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
* (不做数据权限校验,查询全部部门,用于下拉列表展示)
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
List<SysDept> selectDeptOption(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
||||
}
|
||||
|
||||
@ -113,4 +113,18 @@ public interface ISysDeptService {
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询所有部门
|
||||
* (不做数据权限校验,查询全部部门,用于下拉列表展示)
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
List<SysDept> selectDeptOption();
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
* (不做数据权限校验,查询全部部门,用于下拉列表展示)
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
List<Tree<Long>> selectDeptTreeOption();
|
||||
}
|
||||
|
||||
@ -24,6 +24,13 @@ public interface ISysUserService {
|
||||
*/
|
||||
List<SysUser> selectUserList(SysUser user);
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
* 不做数据权限范围控制 用于下拉列表的展示
|
||||
* @return 用户集合信息
|
||||
*/
|
||||
List<SysUser> selectUserOptions();
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
|
||||
@ -56,7 +56,7 @@ public class EquipmentsServiceImpl implements IEquipmentsService {
|
||||
}
|
||||
|
||||
private Map<Long,String> getDeptIdNameMap() {
|
||||
List<SysDept> sysDepts = sysDeptService.selectDeptList(new SysDept());
|
||||
List<SysDept> sysDepts = sysDeptService.selectDeptOption();
|
||||
return StreamUtils.toMap(sysDepts, SysDept::getDeptId, SysDept::getDeptName);
|
||||
}
|
||||
|
||||
|
||||
@ -306,4 +306,32 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||
return baseMapper.deleteById(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有部门
|
||||
* (不做数据权限校验,查询全部部门,用于下拉列表展示)
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> selectDeptOption() {
|
||||
LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
|
||||
// 只查询未禁用部门
|
||||
lqw.eq(SysDept::getDelFlag, "0")
|
||||
.eq(SysDept::getStatus, UserConstants.DEPT_NORMAL)
|
||||
.orderByAsc(SysDept::getParentId)
|
||||
.orderByAsc(SysDept::getOrderNum);
|
||||
return baseMapper.selectDeptOption(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
* (不做数据权限校验,查询全部部门,用于下拉列表展示)
|
||||
*
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> selectDeptTreeOption() {
|
||||
List<SysDept> depts = this.selectDeptOption();
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,17 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return baseMapper.selectUserList(this.buildQueryWrapper(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
* 不做数据权限范围控制 用于下拉列表的展示
|
||||
*
|
||||
* @return 用户集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> selectUserOptions() {
|
||||
return baseMapper.selectList();
|
||||
}
|
||||
|
||||
private Wrapper<SysUser> buildQueryWrapper(SysUser user) {
|
||||
Map<String, Object> params = user.getParams();
|
||||
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.eqc.system.mapper.SysDeptMapper">
|
||||
|
||||
<resultMap type="SysDept" id="SysDeptResult">
|
||||
<resultMap type="com.eqc.common.core.domain.entity.SysDept" id="SysDeptResult">
|
||||
<id property="deptId" column="dept_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="ancestors" column="ancestors"/>
|
||||
@ -36,5 +36,8 @@
|
||||
</if>
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
<select id="selectDeptOption" resultMap="SysDeptResult">
|
||||
select * from sys_dept ${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user