|
@ -34,15 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<result property="beginDate" column="begin_date" /> |
|
|
<result property="beginDate" column="begin_date" /> |
|
|
<result property="endDate" column="end_date" /> |
|
|
<result property="endDate" column="end_date" /> |
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
<sql id="selectDeptVo"> |
|
|
<sql id="selectDeptVo"> |
|
|
select d.id,d.ip_start,d.ip_end,d.is_download,d.is_comment, d.parent_id, d.ancestors, |
|
|
select d.id,d.ip_start,d.ip_end,d.is_download,d.is_comment, d.parent_id, d.ancestors, |
|
|
d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.tag, |
|
|
d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.tag, |
|
|
d.del_flag, d.create_uid, d.create_time, d.name, d.pc_logo, d.pc_background, |
|
|
d.del_flag, d.create_uid, d.create_time, d.name, d.pc_logo, d.pc_background, |
|
|
d.admin_name, d.admin_logo,d.data_type,d.begin_date,d.end_date,d.xzqh_id,d.xzqh_name |
|
|
d.admin_name, d.admin_logo,d.data_type,d.begin_date,d.end_date,d.xzqh_id,d.xzqh_name,d.unifiedSocialCreditCode |
|
|
from sys_dept d |
|
|
from sys_dept d |
|
|
</sql> |
|
|
</sql> |
|
|
|
|
|
|
|
|
<select id="selectDeptList" parameterType="com.jianwei.common.core.domain.entity.SysDept" resultMap="SysDeptResult"> |
|
|
<select id="selectDeptList" parameterType="com.jianwei.common.core.domain.entity.SysDept" resultMap="SysDeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where d.del_flag = '0' |
|
|
where d.del_flag = '0' |
|
@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
${params.dataScope} |
|
|
${params.dataScope} |
|
|
order by d.parent_id, d.order_num |
|
|
order by d.parent_id, d.order_num |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectDeptListByRoleId" parameterType="String" resultType="Integer"> |
|
|
<select id="selectDeptListByRoleId" parameterType="String" resultType="Integer"> |
|
|
select d.id, d.parent_id |
|
|
select d.id, d.parent_id |
|
|
from sys_dept d |
|
|
from sys_dept d |
|
@ -71,34 +71,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
and d.id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.id = rd.dept_id and rd.role_id = #{roleId}) |
|
|
and d.id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.id = rd.dept_id and rd.role_id = #{roleId}) |
|
|
order by d.parent_id, d.order_num |
|
|
order by d.parent_id, d.order_num |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectDeptById" parameterType="String" resultMap="SysDeptResult"> |
|
|
<select id="selectDeptById" parameterType="String" resultMap="SysDeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where id = #{id} |
|
|
where id = #{id} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="checkDeptExistUser" parameterType="String" resultType="int"> |
|
|
<select id="checkDeptExistUser" parameterType="String" resultType="int"> |
|
|
select count(1) from sys_user where id = #{id} and del_flag = '0' |
|
|
select count(1) from sys_user where id = #{id} and del_flag = '0' |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="hasChildByDeptId" parameterType="String" resultType="int"> |
|
|
<select id="hasChildByDeptId" parameterType="String" resultType="int"> |
|
|
select count(1) from sys_dept |
|
|
select count(1) from sys_dept |
|
|
where del_flag = '0' and parent_id = #{id} limit 1 |
|
|
where del_flag = '0' and parent_id = #{id} limit 1 |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectChildrenDeptById" parameterType="String" resultMap="SysDeptResult"> |
|
|
<select id="selectChildrenDeptById" parameterType="String" resultMap="SysDeptResult"> |
|
|
select * from sys_dept where find_in_set(#{id}, ancestors) |
|
|
select * from sys_dept where find_in_set(#{id}, ancestors) |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectNormalChildrenDeptById" parameterType="String" resultType="int"> |
|
|
<select id="selectNormalChildrenDeptById" parameterType="String" resultType="int"> |
|
|
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{id}, ancestors) |
|
|
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{id}, ancestors) |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> |
|
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> |
|
|
<include refid="selectDeptVo"/> |
|
|
<include refid="selectDeptVo"/> |
|
|
where dept_name=#{deptName} and parent_id = #{parentId} limit 1 |
|
|
where dept_name=#{deptName} and parent_id = #{parentId} limit 1 |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<insert id="insertDept" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
<insert id="insertDept" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
insert into sys_dept( |
|
|
insert into sys_dept( |
|
|
<if test="id != null and id != ''">id,</if> |
|
|
<if test="id != null and id != ''">id,</if> |
|
@ -125,6 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<if test="adminName != null and adminName != ''">admin_name,</if> |
|
|
<if test="adminName != null and adminName != ''">admin_name,</if> |
|
|
<if test="adminLogo != null and adminLogo != ''">admin_logo,</if> |
|
|
<if test="adminLogo != null and adminLogo != ''">admin_logo,</if> |
|
|
<if test="xzqhId != null and adminLogo != ''">xzqh_id,</if> |
|
|
<if test="xzqhId != null and adminLogo != ''">xzqh_id,</if> |
|
|
|
|
|
<if test="unifiedSocialCreditCode!=null and unifiedSocialCreditCode!=''">unified_social_credit_code</if> |
|
|
create_time |
|
|
create_time |
|
|
)values( |
|
|
)values( |
|
|
<if test="id != null and id != ''">#{id},</if> |
|
|
<if test="id != null and id != ''">#{id},</if> |
|
@ -151,10 +152,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
<if test="adminName != null and adminName != ''">#{adminName},</if> |
|
|
<if test="adminName != null and adminName != ''">#{adminName},</if> |
|
|
<if test="adminLogo != null and adminLogo != ''">#{adminLogo},</if> |
|
|
<if test="adminLogo != null and adminLogo != ''">#{adminLogo},</if> |
|
|
<if test="xzqhId != null and adminLogo != ''">#{xzqhId},</if> |
|
|
<if test="xzqhId != null and adminLogo != ''">#{xzqhId},</if> |
|
|
|
|
|
<if test="unifiedSocialCreditCode!=null and unifiedSocialCreditCode!=''">#{unifiedSocialCreditCode}</if> |
|
|
sysdate() |
|
|
sysdate() |
|
|
) |
|
|
) |
|
|
</insert> |
|
|
</insert> |
|
|
|
|
|
|
|
|
<update id="updateDept" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
<update id="updateDept" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
update sys_dept |
|
|
update sys_dept |
|
|
<set> |
|
|
<set> |
|
@ -183,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
</set> |
|
|
</set> |
|
|
where id = #{id} |
|
|
where id = #{id} |
|
|
</update> |
|
|
</update> |
|
|
|
|
|
|
|
|
<update id="updateDeptChildren" parameterType="java.util.List"> |
|
|
<update id="updateDeptChildren" parameterType="java.util.List"> |
|
|
update sys_dept set ancestors = |
|
|
update sys_dept set ancestors = |
|
|
<foreach collection="depts" item="item" index="index" |
|
|
<foreach collection="depts" item="item" index="index" |
|
@ -196,7 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
#{item.id} |
|
|
#{item.id} |
|
|
</foreach> |
|
|
</foreach> |
|
|
</update> |
|
|
</update> |
|
|
|
|
|
|
|
|
<update id="updateDeptStatus" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
<update id="updateDeptStatus" parameterType="com.jianwei.common.core.domain.entity.SysDept"> |
|
|
update sys_dept a |
|
|
update sys_dept a |
|
|
<set> |
|
|
<set> |
|
@ -206,9 +208,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
</set> |
|
|
</set> |
|
|
where FIND_IN_SET(a.id,#{ancestors}) |
|
|
where FIND_IN_SET(a.id,#{ancestors}) |
|
|
</update> |
|
|
</update> |
|
|
|
|
|
|
|
|
<delete id="deleteDeptById" parameterType="String"> |
|
|
<delete id="deleteDeptById" parameterType="String"> |
|
|
delete from sys_dept where id = #{id} |
|
|
delete from sys_dept where id = #{id} |
|
|
</delete> |
|
|
</delete> |
|
|
|
|
|
|
|
|
</mapper> |
|
|
</mapper> |
|
|