Parcourir la source

数据逻辑删除不进行唯一验证

RuoYi il y a 3 ans
Parent
commit
b51c127eb7

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
82 82
 	
83 83
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
84 84
 	    <include refid="selectDeptVo"/>
85
-		where dept_name=#{deptName} and parent_id = #{parentId} limit 1
85
+		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
86 86
 	</select>
87 87
     
88 88
     <insert id="insertDept" parameterType="SysDept">

+ 3 - 3
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -85,12 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
85 85
 	
86 86
 	<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
87 87
 		<include refid="selectRoleVo"/>
88
-		 where r.role_name=#{roleName} limit 1
88
+		 where r.role_name=#{roleName} and r.del_flag = '0' limit 1
89 89
 	</select>
90 90
 	
91 91
 	<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
92 92
 		<include refid="selectRoleVo"/>
93
-		 where r.role_key=#{roleKey} limit 1
93
+		 where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
94 94
 	</select>
95 95
 	
96 96
  	<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
@@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
139 139
 	</update>
140 140
 	
141 141
 	<delete id="deleteRoleById" parameterType="Long">
142
-		update sys_role set del_flag = '2' where role_id = #{roleId}
142
+ 		update sys_role set del_flag = '2' where role_id = #{roleId}
143 143
  	</delete>
144 144
  	
145 145
  	<delete id="deleteRoleByIds" parameterType="Long">

+ 5 - 5
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
122 122
 	
123 123
 	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
124 124
 	    <include refid="selectUserVo"/>
125
-		where u.user_name = #{userName}
125
+		where u.user_name = #{userName} and u.del_flag = '0'
126 126
 	</select>
127 127
 	
128 128
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
@@ -131,15 +131,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
131 131
 	</select>
132 132
 	
133 133
 	<select id="checkUserNameUnique" parameterType="String" resultType="int">
134
-		select count(1) from sys_user where user_name = #{userName} limit 1
134
+		select count(1) from sys_user where user_name = #{userName} and del_flag = '0' limit 1
135 135
 	</select>
136 136
 	
137 137
 	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
138
-		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
138
+		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
139 139
 	</select>
140 140
 	
141 141
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
142
-		select user_id, email from sys_user where email = #{email} limit 1
142
+		select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
143 143
 	</select>
144 144
 	
145 145
 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
@@ -208,7 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
208 208
 	</update>
209 209
 	
210 210
 	<delete id="deleteUserById" parameterType="Long">
211
-		update sys_user set del_flag = '2' where user_id = #{userId}
211
+ 		update sys_user set del_flag = '2' where user_id = #{userId}
212 212
  	</delete>
213 213
  	
214 214
  	<delete id="deleteUserByIds" parameterType="Long">