From cc9bb1d05dece7f8b17aeb5f4ebfa1f99c83de38 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 28 十月 2022 19:50:36 +0800
Subject: [PATCH] 优化代码
---
src/main/resources/mybatis/system/SysRoleMapper.xml | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/main/resources/mybatis/system/SysRoleMapper.xml b/src/main/resources/mybatis/system/SysRoleMapper.xml
index 2e96e2d..20cf452 100644
--- a/src/main/resources/mybatis/system/SysRoleMapper.xml
+++ b/src/main/resources/mybatis/system/SysRoleMapper.xml
@@ -33,6 +33,9 @@
<select id="selectRoleList" parameterType="SysRole" 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>
@@ -62,7 +65,7 @@
<include refid="selectRoleVo"/>
</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
@@ -82,12 +85,12 @@
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
- where r.role_name=#{roleName} limit 1
+ where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
- where r.role_key=#{roleKey} limit 1
+ where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
--
Gitblit v1.9.3