疯狂的狮子Li
2023-01-13 68e57803f3386ab4f5211dd30e4d8ade9d24f0a4
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -22,16 +22,19 @@
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <select id="selectDeptListByRoleId" resultType="Integer">
    <select id="selectDeptList" resultMap="SysDeptResult">
        select * from sys_dept ${ew.getCustomSqlSegment}
    </select>
    <select id="selectDeptListByRoleId" resultType="Long">
        select d.dept_id
        from sys_dept d
        left join sys_role_dept rd on d.dept_id = rd.dept_id
            left join sys_role_dept rd on d.dept_id = rd.dept_id
        where rd.role_id = #{roleId}
        <if test="deptCheckStrictly">
            and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
            rd.dept_id and rd.role_id = #{roleId})
        </if>
            <if test="deptCheckStrictly">
                and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
            </if>
        order by d.parent_id, d.order_num
    </select>
</mapper>
</mapper>