2024-12-02 17:01:20 +08:00
|
|
|
<?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.bonus.system.att.dao.OrgChangeDao">
|
|
|
|
|
|
|
|
|
|
<select id="selectOrgChangeList" resultType="com.bonus.system.att.entity.OrgChangeBean">
|
|
|
|
|
SELECT
|
|
|
|
|
su.user_name,
|
|
|
|
|
so.org_name AS oldOrgName,
|
|
|
|
|
so2.org_name AS newOrgName,
|
|
|
|
|
oc.*
|
|
|
|
|
FROM
|
|
|
|
|
org_change oc
|
|
|
|
|
LEFT JOIN sys_user su ON oc.user_id = su.user_id
|
|
|
|
|
AND su.is_active = '1'
|
|
|
|
|
LEFT JOIN sys_organization so ON oc.old_org_id = so.id
|
|
|
|
|
AND so.is_active = '1'
|
|
|
|
|
LEFT JOIN sys_organization so2 ON oc.new_org_id = so2.id
|
|
|
|
|
AND so2.is_active = '1'
|
|
|
|
|
WHERE
|
|
|
|
|
oc.is_active = '1'
|
2024-12-02 17:39:00 +08:00
|
|
|
<if test="userId != null and userId != '' ">
|
|
|
|
|
and oc.user_id = #{userId}
|
|
|
|
|
</if>
|
2024-12-02 17:01:20 +08:00
|
|
|
<if test="startTime != null and startTime != '' ">
|
|
|
|
|
and oc.create_time between #{startTime} and #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isCheck != null and isCheck != '' ">
|
2024-12-02 18:26:00 +08:00
|
|
|
<if test="isCheck == '-1'">
|
|
|
|
|
and oc.is_check in (0,1,2)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isCheck != '-1'">
|
|
|
|
|
and oc.is_check = #{isCheck}
|
|
|
|
|
</if>
|
2024-12-02 17:01:20 +08:00
|
|
|
</if>
|
2024-12-02 17:39:00 +08:00
|
|
|
group by oc.is_check ASC
|
2024-12-02 17:01:20 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrgChangeById" resultType="com.bonus.system.att.entity.OrgChangeBean">
|
|
|
|
|
SELECT
|
|
|
|
|
su.user_name,
|
|
|
|
|
so.org_name AS oldOrgName,
|
|
|
|
|
so2.org_name AS newOrgName,
|
|
|
|
|
oc.*
|
|
|
|
|
FROM
|
|
|
|
|
org_change oc
|
|
|
|
|
LEFT JOIN sys_user su ON oc.user_id = su.user_id
|
|
|
|
|
AND su.is_active = '1'
|
|
|
|
|
LEFT JOIN sys_organization so ON oc.old_org_id = so.id
|
|
|
|
|
AND so.is_active = '1'
|
|
|
|
|
LEFT JOIN sys_organization so2 ON oc.new_org_id = so2.id
|
|
|
|
|
AND so2.is_active = '1'
|
|
|
|
|
WHERE
|
|
|
|
|
oc.is_active = '1'
|
|
|
|
|
and oc.id = #{id}
|
|
|
|
|
</select>
|
2024-12-02 18:42:45 +08:00
|
|
|
<select id="getAttGroupList" resultType="com.bonus.system.api.domain.MapVo">
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
group_name AS `name`
|
|
|
|
|
FROM
|
|
|
|
|
att_group
|
|
|
|
|
WHERE
|
|
|
|
|
is_active = '1'
|
|
|
|
|
</select>
|
2024-12-02 17:01:20 +08:00
|
|
|
|
|
|
|
|
<delete id="deleteAttGroup">
|
2024-12-02 17:39:00 +08:00
|
|
|
update org_change
|
2024-12-02 17:01:20 +08:00
|
|
|
set is_active = 0
|
2024-12-02 17:39:00 +08:00
|
|
|
where id = #{id}
|
2024-12-02 17:01:20 +08:00
|
|
|
</delete>
|
|
|
|
|
|
2024-12-02 19:36:21 +08:00
|
|
|
<insert id="insertOrgChange">
|
2024-12-02 17:01:20 +08:00
|
|
|
insert into org_change(user_id, old_org_id, new_org_id,is_change_att_group, change_effective_date, is_check
|
|
|
|
|
<if test="oldAttGroup != null and oldAttGroup != ''">,old_att_group</if>
|
|
|
|
|
<if test="newAttGroup != null and newAttGroup != ''">,new_att_group</if>
|
2024-12-02 17:39:00 +08:00
|
|
|
)
|
|
|
|
|
values (#{userId},#{oldOrgId},#{newOrgId},#{isChangeAttGroup},#{changeEffectiveDate},#{isCheck}
|
2024-12-02 17:01:20 +08:00
|
|
|
<if test="oldAttGroup != null and oldAttGroup != ''">,#{oldAttGroup}</if>
|
|
|
|
|
<if test="newAttGroup != null and newAttGroup != ''">,#{newAttGroup}</if>
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateOrgChange">
|
2024-12-02 17:39:00 +08:00
|
|
|
update org_change set user_id = #{userId}, old_org_id = #{oldOrgId}, new_org_id = #{newOrgId},
|
|
|
|
|
is_change_att_group = #{isChangeAttGroup}, change_effective_date = #{changeEffectiveDate},
|
|
|
|
|
is_check = #{isCheck}
|
|
|
|
|
<if test="oldAttGroup != null and oldAttGroup != ''">,old_att_group = #{oldAttGroup}</if>
|
|
|
|
|
<if test="newAttGroup != null and newAttGroup != ''">,new_att_group = #{newAttGroup}</if>
|
|
|
|
|
where id = #{id}
|
2024-12-02 17:01:20 +08:00
|
|
|
</update>
|
2024-12-02 17:39:00 +08:00
|
|
|
<update id="orgChangeCheck">
|
|
|
|
|
update org_change
|
|
|
|
|
<set>
|
|
|
|
|
<if test="checkUserId != 0L">
|
|
|
|
|
remark = #{remark},
|
|
|
|
|
check_user_id = #{checkUserId},
|
|
|
|
|
check_time = #{checkTime},
|
|
|
|
|
</if>
|
|
|
|
|
is_check = #{isCheck}
|
|
|
|
|
</set>
|
|
|
|
|
where id = #{id}
|
2024-12-02 17:01:20 +08:00
|
|
|
</update>
|
2024-12-02 17:39:00 +08:00
|
|
|
|
2024-12-02 17:01:20 +08:00
|
|
|
</mapper>
|