Browse Source

修改部門status/del_flay

hexiao 2 years ago
parent
commit
eccfc30a27

+ 8 - 4
base-common/src/main/java/com/ozs/common/constant/UserConstants.java

@@ -24,11 +24,15 @@ public class UserConstants
     /** 角色封禁状态 */
     public static final String ROLE_DISABLE = "1";
 
-    /** 部门正常状态 */
-    public static final String DEPT_NORMAL = "0";
+    /**
+     * 部门正常状态
+     */
+    public static final String DEPT_NORMAL = "1";
 
-    /** 部门停用状态 */
-    public static final String DEPT_DISABLE = "1";
+    /**
+     * 部门停用状态
+     */
+    public static final String DEPT_DISABLE = "2";
 
     /** 字典正常状态 */
     public static final String DICT_NORMAL = "0";

+ 20 - 9
base-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
-        where d.del_flag = '0'
+		where d.del_flag = '1'
 		<if test="deptId != null and deptId != 0">
 			AND dept_id = #{deptId}
 		</if>
@@ -70,12 +70,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
     <select id="checkDeptExistUser" parameterType="Long" resultType="int">
-		select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
+		select count(1)
+		from sys_user
+		where dept_id = #{deptId}
+		  and del_flag = 1
 	</select>
 
 	<select id="hasChildByDeptId" parameterType="Long" resultType="int">
-		select count(1) from sys_dept
-		where del_flag = '0' and parent_id = #{deptId} limit 1
+		select count(1)
+		from sys_dept
+		where del_flag = 1
+		  and parent_id = #{deptId} limit 1
 	</select>
 
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
@@ -83,12 +88,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
-		select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
+		select count(*)
+		from sys_dept
+		where status = 1
+		  and del_flag = 1
+		  and find_in_set(#{deptId}, ancestors)
 	</select>
 
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = 1 limit 1
 	</select>
 
     <insert id="insertDept" parameterType="SysDept">
@@ -150,14 +159,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</update>
 
 	<update id="updateDeptStatusNormal" parameterType="Long">
- 	    update sys_dept set status = '0' where dept_id in
- 	    <foreach collection="array" item="deptId" open="(" separator="," close=")">
+		update sys_dept set status = 1 where dept_id in
+		<foreach collection="array" item="deptId" open="(" separator="," close=")">
         	#{deptId}
         </foreach>
 	</update>
 
 	<delete id="deleteDeptById" parameterType="Long">
-		update sys_dept set del_flag = '2' where dept_id = #{deptId}
+		update sys_dept
+		set del_flag = 2
+		where dept_id = #{deptId}
 	</delete>
 
 </mapper>