chenrui
2025-06-03 6e7c712456a8cf5693321edd2f3482aaf61d08b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?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">
<mapper namespace="com.ruoyi.project.system.mapper.SysUserDeptMapper">
    
    <select id="selectUserDeptList" resultType="com.ruoyi.project.system.domain.vo.SysUserDeptVo">
        SELECT
            T1.user_id,
            T1.dept_id,
            T2.dept_name
        FROM
            sys_user_dept T1
        LEFT JOIN sys_dept T2 ON T1.dept_id = T2.dept_id
        <where>
            <if test="userDeptVo.userId != null">
                T1.user_id = #{userDeptVo.userId}
            </if>
        </where>
    </select>
</mapper>