Commit 51fa66f61aca23d5c8a119672f75fcd291a6cff2

Authored by RuoYi
1 parent 3b61ed56

唯一限制条件只返回单条数据

ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
... ... @@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
61 61  
62 62 <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
63 63 <include refid="selectConfigVo"/>
64   - where config_key = #{configKey}
  64 + where config_key = #{configKey} limit 1
65 65 </select>
66 66  
67 67 <insert id="insertConfig" parameterType="SysConfig">
... ...
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
... ... @@ -64,7 +64,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
64 64  
65 65 <select id="hasChildByDeptId" parameterType="Long" resultType="int">
66 66 select count(1) from sys_dept
67   - where del_flag = '0' and parent_id = #{deptId}
  67 + where del_flag = '0' and parent_id = #{deptId} limit 1
68 68 </select>
69 69  
70 70 <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
... ...
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
... ... @@ -57,7 +57,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
57 57  
58 58 <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
59 59 <include refid="selectDictTypeVo"/>
60   - where dict_type = #{dictType}
  60 + where dict_type = #{dictType} limit 1
61 61 </select>
62 62  
63 63 <delete id="deleteDictTypeById" parameterType="Long">
... ...
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
... ... @@ -118,7 +118,7 @@
118 118  
119 119 <select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
120 120 <include refid="selectMenuVo"/>
121   - where menu_name=#{menuName} and parent_id = #{parentId}
  121 + where menu_name=#{menuName} and parent_id = #{parentId} limit 1
122 122 </select>
123 123  
124 124 <update id="updateMenu" parameterType="SysMenu">
... ...
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
... ... @@ -64,12 +64,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
64 64  
65 65 <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
66 66 <include refid="selectPostVo"/>
67   - where post_name=#{postName}
  67 + where post_name=#{postName} limit 1
68 68 </select>
69 69  
70 70 <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
71 71 <include refid="selectPostVo"/>
72   - where post_code=#{postCode}
  72 + where post_code=#{postCode} limit 1
73 73 </select>
74 74  
75 75 <update id="updatePost" parameterType="SysPost">
... ...
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
... ... @@ -80,12 +80,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
80 80  
81 81 <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
82 82 <include refid="selectRoleVo"/>
83   - where r.role_name=#{roleName}
  83 + where r.role_name=#{roleName} limit 1
84 84 </select>
85 85  
86 86 <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
87 87 <include refid="selectRoleVo"/>
88   - where r.role_key=#{roleKey}
  88 + where r.role_key=#{roleKey} limit 1
89 89 </select>
90 90  
91 91 <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
... ...
ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
... ... @@ -10,7 +10,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
10 10 </resultMap>
11 11  
12 12 <select id="checkMenuExistRole" resultType="Integer">
13   - select count(1) from sys_role_menu where menu_id = #{menuId}
  13 + select count(1) from sys_role_menu where menu_id = #{menuId}
14 14 </select>
15 15  
16 16 <delete id="deleteRoleMenuByRoleId" parameterType="Long">
... ...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
... ... @@ -92,15 +92,15 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
92 92 </select>
93 93  
94 94 <select id="checkUserNameUnique" parameterType="String" resultType="int">
95   - select count(1) from sys_user where user_name = #{userName}
  95 + select count(1) from sys_user where user_name = #{userName} limit 1
96 96 </select>
97 97  
98 98 <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
99   - select user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
  99 + select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
100 100 </select>
101 101  
102 102 <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
103   - select user_id, email from sys_user where email = #{email}
  103 + select user_id, email from sys_user where email = #{email} limit 1
104 104 </select>
105 105  
106 106 <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
... ...