From f3aff3460203eef795e9b5a5b3dd41368cc5ec39 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 16 一月 2023 11:16:37 +0800 Subject: [PATCH] update 优化 调整 system entity 实体与 controller 包结构 --- ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml | 79 +++++---------------------------------- 1 files changed, 11 insertions(+), 68 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index fc1214c..875352b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -4,21 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.system.mapper.SysRoleMapper"> - <resultMap type="SysRole" id="SysRoleResult"> - <id property="roleId" column="role_id"/> - <result property="roleName" column="role_name"/> - <result property="roleKey" column="role_key"/> - <result property="roleSort" column="role_sort"/> - <result property="dataScope" column="data_scope"/> - <result property="menuCheckStrictly" column="menu_check_strictly"/> - <result property="deptCheckStrictly" column="dept_check_strictly"/> - <result property="status" column="status"/> - <result property="delFlag" column="del_flag"/> - <result property="createBy" column="create_by"/> - <result property="createTime" column="create_time"/> - <result property="updateBy" column="update_by"/> - <result property="updateTime" column="update_time"/> - <result property="remark" column="remark"/> + <resultMap type="com.ruoyi.system.domain.SysRole" id="SysRoleResult"> </resultMap> <sql id="selectRoleVo"> @@ -34,74 +20,31 @@ r.create_time, r.remark from sys_role r - left join sys_user_role ur on ur.role_id = r.role_id - left join sys_user u on u.user_id = ur.user_id + left join sys_user_role sur on sur.role_id = r.role_id + left join sys_user u on u.user_id = sur.user_id left join sys_dept d on u.dept_id = d.dept_id </sql> - <select id="selectPageRoleList" parameterType="SysRole" resultMap="SysRoleResult"> + <select id="selectPageRoleList" resultMap="SysRoleResult"> <include refid="selectRoleVo"/> - where r.del_flag = '0' - <if test="role.roleName != null and role.roleName != ''"> - AND r.role_name like concat('%', #{role.roleName}, '%') - </if> - <if test="role.status != null and role.status != ''"> - AND r.status = #{role.status} - </if> - <if test="role.roleKey != null and role.roleKey != ''"> - AND r.role_key like concat('%', #{role.roleKey}, '%') - </if> - <if test="role.params.beginTime != null and role.params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� --> - and date_format(r.create_time,'%y%m%d') >= date_format(#{role.params.beginTime},'%y%m%d') - </if> - <if test="role.params.endTime != null and role.params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> - and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d') - </if> - <!-- 鏁版嵁鑼冨洿杩囨护 --> - <if test="role.params.dataScope != null and role.params.dataScope != ''"> - AND ( ${role.params.dataScope} ) - </if> - order by r.role_sort + ${ew.getCustomSqlSegment} </select> - <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> + <select id="selectRoleList" resultMap="SysRoleResult"> <include refid="selectRoleVo"/> - where r.del_flag = '0' - <if test="roleId != null and roleId != 0"> - AND r.role_id = #{roleId} - </if> - <if test="roleName != null and roleName != ''"> - AND r.role_name like concat('%', #{roleName}, '%') - </if> - <if test="status != null and status != ''"> - AND r.status = #{status} - </if> - <if test="roleKey != null and roleKey != ''"> - AND r.role_key like concat('%', #{roleKey}, '%') - </if> - <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� --> - and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') - </if> - <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> - and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') - </if> - <!-- 鏁版嵁鑼冨洿杩囨护 --> - <if test="params.dataScope != null and params.dataScope != ''"> - AND ( ${params.dataScope} ) - </if> - order by r.role_sort + ${ew.getCustomSqlSegment} </select> <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> <include refid="selectRoleVo"/> - WHERE r.del_flag = '0' and ur.user_id = #{userId} + WHERE r.del_flag = '0' and sur.user_id = #{userId} </select> - <select id="selectRoleListByUserId" parameterType="Long" resultType="Integer"> + <select id="selectRoleListByUserId" parameterType="Long" resultType="Long"> select r.role_id from sys_role r - left join sys_user_role ur on ur.role_id = r.role_id - left join sys_user u on u.user_id = ur.user_id + left join sys_user_role sur on sur.role_id = r.role_id + left join sys_user u on u.user_id = sur.user_id where u.user_id = #{userId} </select> -- Gitblit v1.9.3