<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.gkhy.hazmat.system.mapper.SysDeptMapper">
|
|
|
<update id="updateDeptStatusNormal" parameterType="Long">
|
update sys_dept set status = 0 where id in
|
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
#{deptId}
|
</foreach>
|
</update>
|
|
<update id="updateDeptChildren" parameterType="java.util.List">
|
update sys_dept set ancestors =
|
<foreach collection="depts" item="item" index="index"
|
separator=" " open="case id" close="end">
|
when #{item.id} then #{item.ancestors}
|
</foreach>
|
where id in
|
<foreach collection="depts" item="item" index="index"
|
separator="," open="(" close=")">
|
#{item.deptId}
|
</foreach>
|
</update>
|
|
<select id="selectDeptList" resultType="com.gkhy.hazmat.system.domain.SysDept"
|
parameterType="com.gkhy.hazmat.system.domain.SysDept">
|
select * from sys_dept
|
<where>
|
and del_flag=0
|
<if test="companyId!=null">
|
and company_id=#{companyId}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectChildrenDeptById" resultType="com.gkhy.hazmat.system.domain.SysDept"
|
parameterType="java.lang.Long">
|
select * from sys_dept where parent_id=#{deptId} and del_flag=0
|
</select>
|
|
<select id="hasChildByDeptId" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
select count(1) from sys_dept where parent_id=#{deptId} and del_flag=0
|
</select>
|
|
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
select count(1) from sys_user where depart_id = #{deptId} and del_flag = 0
|
</select>
|
|
|
<select id="selectNormalChildrenDeptById" resultType="java.lang.Integer" parameterType="java.lang.Long"></select>
|
|
|
<select id="checkNameUnique" resultType="com.gkhy.hazmat.system.domain.SysDept">
|
select id,name from sys_dept where name=#{name} and parent_id=#{parentId} and company_id=#{companyId} limit 1
|
</select>
|
</mapper>
|