update 简化查询部门功能
This commit is contained in:
parent
f41bfdb8eb
commit
00549c267f
@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.ruoyi.common.annotation.DataColumn;
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
import com.ruoyi.common.annotation.DataPermission;
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
@ -18,13 +20,13 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, Sy
|
|||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param queryWrapper 查询条件
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "d.dept_id")
|
@DataColumn(key = "deptName", value = "dept_id")
|
||||||
})
|
})
|
||||||
List<SysDept> selectDeptList(SysDept dept);
|
List<SysDept> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
|
@ -46,7 +46,15 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDept> selectDeptList(SysDept dept) {
|
public List<SysDept> selectDeptList(SysDept dept) {
|
||||||
return baseMapper.selectDeptList(dept);
|
LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.eq(SysDept::getDelFlag, "0")
|
||||||
|
.eq(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId())
|
||||||
|
.eq(ObjectUtil.isNotNull(dept.getParentId()), SysDept::getParentId, dept.getParentId())
|
||||||
|
.like(StringUtils.isNotBlank(dept.getDeptName()), SysDept::getDeptName, dept.getDeptName())
|
||||||
|
.eq(StringUtils.isNotBlank(dept.getStatus()), SysDept::getStatus, dept.getStatus())
|
||||||
|
.orderByAsc(SysDept::getParentId)
|
||||||
|
.orderByAsc(SysDept::getOrderNum);
|
||||||
|
return baseMapper.selectDeptList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,27 +22,8 @@
|
|||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<select id="selectDeptList" resultMap="SysDeptResult">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
select * from sys_dept ${ew.getCustomSqlSegment}
|
||||||
from sys_dept d
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
|
||||||
<include refid="selectDeptVo"/>
|
|
||||||
where d.del_flag = '0'
|
|
||||||
<if test="deptId != null and deptId != 0">
|
|
||||||
AND dept_id = #{deptId}
|
|
||||||
</if>
|
|
||||||
<if test="parentId != null and parentId != 0">
|
|
||||||
AND parent_id = #{parentId}
|
|
||||||
</if>
|
|
||||||
<if test="deptName != null and deptName != ''">
|
|
||||||
AND dept_name like concat('%', #{deptName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="status != null and status != ''">
|
|
||||||
AND status = #{status}
|
|
||||||
</if>
|
|
||||||
order by d.parent_id, d.order_num
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Long">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user