<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mappernamespace="com.ruoyi.project.system.dept.mapper.DeptMapper"><resultMaptype="Dept"id="DeptResult"><idproperty="deptId"column="dept_id"/><resultproperty="parentId"column="parent_id"/><resultproperty="ancestors"column="ancestors"/><resultproperty="deptName"column="dept_name"/><resultproperty="orderNum"column="order_num"/><resultproperty="leader"column="leader"/><resultproperty="phone"column="phone"/><resultproperty="email"column="email"/><resultproperty="status"column="status"/><resultproperty="delFlag"column="del_flag"/><resultproperty="parentName"column="parent_name"/><resultproperty="createBy"column="create_by"/><resultproperty="createTime"column="create_time"/><resultproperty="updateBy"column="update_by"/><resultproperty="updateTime"column="update_time"/></resultMap><sqlid="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><selectid="selectDeptList"parameterType="Dept"resultMap="DeptResult"><includerefid="selectDeptVo"/>
where d.del_flag = '0'
<iftest="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if><iftest="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if><iftest="status != null and status != ''">
AND status = #{status}
</if><!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select></mapper>
部门多级联动1、部门都在一张表中1.1 数据库表/* Navicat Premium Data Transfer Source Server : SuggestCollection Source Server Type : MySQL Source Server Version : 80016 Source Host : rm-uf6k821nmo8j76x81to.mysql.rds.aliyuncs.com:3306 Source Schem