From 6192d425642f1205f650e16157dbef2a15007978 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期日, 30 五月 2021 02:18:34 +0800 Subject: [PATCH] update 优化代码生成模板 --- ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 07fc5d6..21f6854 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -22,16 +22,39 @@ <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="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> + <!-- 鏁版嵁鑼冨洿杩囨护 --> + <if test="params.dataScope != null and params.dataScope != ''"> + AND ( ${params.dataScope} ) + </if> + order by d.parent_id, d.order_num + </select> + <select id="selectDeptListByRoleId" resultType="Integer"> select d.dept_id from sys_dept d 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> \ No newline at end of file +</mapper> -- Gitblit v1.9.3