215 lines
8.2 KiB
XML
215 lines
8.2 KiB
XML
<?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.evection.dao.EvectionDao">
|
|
|
|
<insert id="insertEvection">
|
|
INSERT INTO leave_apply(user_id, user_name, org_id, org_name, leave_type, leave_reason,
|
|
leave_start_date, leave_start_interval, leave_end_date, leave_end_interval,
|
|
leave_duration, source, create_user_id, is_agree, location, host_user_id, remark
|
|
, leave_form_id, submit_id,examine_status)
|
|
VALUES (#{userId}, #{userName}, #{orgId}, #{orgName}, '出差报备', #{leaveReason},
|
|
#{leaveStartDate}, #{leaveStartInterval}, #{leaveEndDate}, #{leaveEndInterval},
|
|
#{leaveDuration}, #{source}, #{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark},
|
|
#{uuid}, #{createUserId},'1')
|
|
</insert>
|
|
|
|
<update id="updateEvection">
|
|
UPDATE leave_apply
|
|
<set>
|
|
<if test="userId != null and userId != ''">
|
|
user_id = #{userId},
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
user_name = #{userName},
|
|
</if>
|
|
<if test="orgId != null and orgId != ''">
|
|
org_id = #{orgId},
|
|
</if>
|
|
<if test="orgName != null and orgName != ''">
|
|
org_name = #{orgName},
|
|
</if>
|
|
|
|
<if test="type != null and type != ''">
|
|
type = #{type},
|
|
</if>
|
|
<if test="hostUserId != null and hostUserId != ''">
|
|
host_user_id = #{hostUserId},
|
|
</if>
|
|
<if test="location != null and location != ''">
|
|
location = #{location},
|
|
</if>
|
|
<if test="isAgree != null and isAgree != ''">
|
|
is_agree = #{isAgree},
|
|
</if>
|
|
|
|
<if test="remark != null and remark != ''">
|
|
remark = #{remark},
|
|
</if>
|
|
|
|
leave_reason = #{leaveReason},
|
|
leave_start_date = #{leaveStartDate},
|
|
leave_start_interval = #{leaveStartInterval},
|
|
leave_end_date = #{leaveEndDate},
|
|
leave_end_interval = #{leaveEndInterval},
|
|
leave_duration = #{leaveDuration},
|
|
update_user_id = #{updateUserId}
|
|
</set>
|
|
where leave_form_id = #{uuid}
|
|
</update>
|
|
|
|
<update id="deleteEvectionById">
|
|
update leave_apply
|
|
SET is_active = '0'
|
|
WHERE leave_form_id = #{uuid}
|
|
</update>
|
|
|
|
<select id="getEvectionList" resultType="com.bonus.system.evection.entity.EvectionBean">
|
|
SELECT a.*,
|
|
GROUP_CONCAT( CASE WHEN a.user_ids != su.user_id THEN a.user_ids END SEPARATOR ', ' ) AS travelers,
|
|
GROUP_CONCAT( CASE WHEN a.user_names != su.user_name THEN a.user_names END SEPARATOR ', ' ) AS travelersName,
|
|
su.user_id ,su.user_name
|
|
FROM (
|
|
SELECT
|
|
l.id,
|
|
l.user_id as user_ids,
|
|
l.user_name as user_names,
|
|
l.org_id,
|
|
l.org_name,
|
|
l.create_time,
|
|
l.leave_type,
|
|
l.type,
|
|
l.leave_reason,
|
|
l.leave_start_date,
|
|
l.leave_start_interval,
|
|
l.leave_end_date,
|
|
l.leave_end_interval,
|
|
l.leave_duration,
|
|
GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName,
|
|
l.leave_form_id as uuid,
|
|
l.submit_id,
|
|
l.update_time
|
|
FROM
|
|
leave_apply l
|
|
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
|
|
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
|
|
WHERE
|
|
l.is_active = '1' AND l.leave_type = '出差报备' AND l.source = '1'
|
|
<if test='bean.orgList != null and bean.orgList.size() > 0'>
|
|
and org_id in (
|
|
<foreach collection="bean.orgList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="params.beginTime != null and params.beginTime != ''">
|
|
and date_format(l.leave_start_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
</if>
|
|
<if test="params.endTime != null and params.endTime != ''">
|
|
and date_format(l.leave_end_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
</if>
|
|
GROUP BY
|
|
l.id,
|
|
l.user_id,
|
|
l.user_name,
|
|
l.org_id,
|
|
l.org_name,
|
|
l.create_time,
|
|
l.leave_type,
|
|
l.leave_reason,
|
|
l.leave_start_date,
|
|
l.leave_start_interval,
|
|
l.leave_end_date,
|
|
l.leave_end_interval,
|
|
l.leave_duration,
|
|
l.examine_status,
|
|
l.submit_id
|
|
ORDER BY l.update_time DESC
|
|
) a
|
|
LEFT JOIN sys_user su ON su.user_id = a.submit_id
|
|
GROUP BY uuid
|
|
ORDER BY leave_start_date DESC
|
|
</select>
|
|
|
|
<select id="selectEvectionById"
|
|
resultType="com.bonus.system.evection.entity.EvectionBean">
|
|
SELECT a.*,
|
|
GROUP_CONCAT( CASE WHEN a.user_ids != su.user_id THEN a.user_ids END SEPARATOR ', ' ) AS travelers,
|
|
GROUP_CONCAT( CASE WHEN a.user_names != su.user_name THEN a.user_names END SEPARATOR ', ' ) AS travelersName,
|
|
su.user_id,
|
|
su.user_name
|
|
FROM (SELECT l.id,
|
|
l.user_id as user_ids,
|
|
l.user_name as user_names,
|
|
l.org_id,
|
|
l.org_name,
|
|
l.create_time,
|
|
l.leave_type,
|
|
l.type,
|
|
l.leave_reason,
|
|
l.leave_start_date,
|
|
l.leave_start_interval,
|
|
l.leave_end_date,
|
|
l.leave_end_interval,
|
|
l.leave_duration,
|
|
GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName,
|
|
l.leave_form_id as uuid,
|
|
l.submit_id,
|
|
l.host_user_id,
|
|
l.is_agree,
|
|
l.location,
|
|
l.remark
|
|
FROM leave_apply l
|
|
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
|
|
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
|
|
WHERE l.is_active = '1'
|
|
AND l.leave_type = '出差报备'
|
|
and l.leave_form_id = #{uuid}
|
|
GROUP BY l.id,
|
|
l.user_id,
|
|
l.user_name,
|
|
l.org_id,
|
|
l.org_name,
|
|
l.create_time,
|
|
l.leave_type,
|
|
l.leave_reason,
|
|
l.leave_start_date,
|
|
l.leave_start_interval,
|
|
l.leave_end_date,
|
|
l.leave_end_interval,
|
|
l.leave_duration,
|
|
l.examine_status,
|
|
l.submit_id,
|
|
l.host_user_id,
|
|
l.is_agree,
|
|
l.location,
|
|
l.remark
|
|
ORDER BY l.update_time DESC) a
|
|
LEFT JOIN sys_user su ON su.user_id = a.submit_id
|
|
GROUP BY uuid
|
|
</select>
|
|
|
|
<select id="getPostName" resultType="com.bonus.system.evection.entity.EvectionBean">
|
|
SELECT GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName
|
|
FROM sys_user_post p
|
|
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
|
|
WHERE p.user_id = #{id}
|
|
</select>
|
|
|
|
<select id="getUserList" resultType="com.bonus.system.evection.entity.EvectionBean">
|
|
SELECT 0 as userId, '/' AS userName
|
|
UNION ALL
|
|
SELECT su.user_id as userId, su.user_name as userName
|
|
FROM sys_user su
|
|
LEFT JOIN sys_user_org suo ON su.user_id = suo.user_id AND su.user_id != #{params.id}
|
|
WHERE 1=1
|
|
<if test='params.orgList != null and params.orgList.size() > 0'>
|
|
and suo.org_id in (
|
|
<foreach collection="params.orgList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
</select>
|
|
</mapper> |