| | |
| | | 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.DataPermission; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | |
| | | /** |
| | | * 查询部门管理数据 |
| | | * |
| | | * @param dept 部门信息 |
| | | * @param queryWrapper 查询条件 |
| | | * @return 部门信息集合 |
| | | */ |
| | | @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查询部门树信息 |
| | |
| | | */ |
| | | @Override |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectDeptVo"> |
| | | 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 |
| | | 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 id="selectDeptList" resultMap="SysDeptResult"> |
| | | select * from sys_dept ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="selectDeptListByRoleId" resultType="Long"> |