2024-12-02 11:13:48 +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.holiday.dao.HolidayDao">
|
2024-12-19 16:53:44 +08:00
|
|
|
<insert id="insertHoliday" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
2024-12-02 11:13:48 +08:00
|
|
|
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,examine_status,source,create_user_id,is_agree, location, host_user_id, remark,type)
|
|
|
|
|
VALUES(#{userId},#{userName},#{orgId},#{orgName},#{leaveType},#{leaveReason},
|
|
|
|
|
#{leaveStartDate},#{leaveStartInterval},#{leaveEndDate},#{leaveEndInterval},
|
|
|
|
|
#{leaveDuration},#{examineStatus},#{source},#{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark}, #{type})
|
|
|
|
|
</insert>
|
|
|
|
|
<update id="updateHoliday">
|
|
|
|
|
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>
|
|
|
|
|
leave_reason = #{leaveReason},
|
|
|
|
|
leave_start_date = #{leaveStartDate},
|
|
|
|
|
leave_start_interval = #{leaveStartInterval},
|
|
|
|
|
leave_end_date = #{leaveEndDate},
|
|
|
|
|
leave_end_interval = #{leaveEndInterval},
|
|
|
|
|
leave_duration = #{leaveDuration},
|
|
|
|
|
examine_status = #{examineStatus},
|
|
|
|
|
update_user_id = #{updateUserId},
|
|
|
|
|
is_agree = #{isAgree},
|
|
|
|
|
location = #{location},
|
|
|
|
|
host_user_id = #{hostUserId},
|
|
|
|
|
remark = #{remark}
|
|
|
|
|
</set>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="changeHolidayStatus">
|
|
|
|
|
update leave_apply
|
|
|
|
|
<set>
|
|
|
|
|
<if test="updateUserId != 0L">
|
|
|
|
|
examine_opinion = #{examineOpinion},
|
|
|
|
|
examine_user_id = #{examineUserId},
|
|
|
|
|
examine_time = #{examineTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="examineUserId != 0L">
|
|
|
|
|
update_user_id = #{updateUserId},
|
|
|
|
|
</if>
|
|
|
|
|
examine_status = #{examineStatus}
|
|
|
|
|
</set>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteHolidayById">
|
|
|
|
|
update leave_apply SET is_active = '0' WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="getHolidayList" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
|
|
|
|
SELECT
|
2024-12-20 15:08:28 +08:00
|
|
|
la.id,
|
|
|
|
|
la.user_id,
|
|
|
|
|
la.user_name,
|
|
|
|
|
la.org_id,
|
|
|
|
|
la.org_name,
|
|
|
|
|
la.create_time,
|
|
|
|
|
la.leave_type,
|
|
|
|
|
la.leave_reason,
|
|
|
|
|
la.leave_start_date,
|
|
|
|
|
la.leave_start_interval,
|
|
|
|
|
la.leave_end_date,
|
|
|
|
|
la.leave_end_interval,
|
|
|
|
|
la.leave_duration,
|
|
|
|
|
la.examine_status
|
2024-12-02 11:13:48 +08:00
|
|
|
FROM
|
2024-12-20 15:08:28 +08:00
|
|
|
leave_apply la
|
|
|
|
|
left join (select user_Id,GROUP_CONCAT( org_id ) AS org_id FROM sys_user_org where is_active = '1' group by user_id) suo on suo.user_id = la.user_id
|
2024-12-02 11:13:48 +08:00
|
|
|
WHERE
|
|
|
|
|
is_active = '1'
|
|
|
|
|
<if test="bean.leaveDate != null and bean.leaveDate != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and locate(#{bean.leaveDate},la.create_time)
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.examineStatus != null and bean.examineStatus != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and la.examine_status = #{bean.examineStatus}
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.leaveType != null and bean.leaveType != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and locate(#{bean.leaveType},la.leave_type)
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.type != null and bean.type != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and locate(#{bean.type},la.type)
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.orgName != null and bean.orgName != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and locate(#{bean.orgName},la.org_name)
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.userName != null and bean.userName != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and locate(#{bean.userName},la.user_name)
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="bean.userId != null and bean.userId != '' ">
|
2024-12-20 15:08:28 +08:00
|
|
|
and (la.user_id = #{bean.userId} or la.create_user_id = #{bean.userId} )
|
2024-12-02 11:13:48 +08:00
|
|
|
</if>
|
|
|
|
|
<if test='bean.orgList != null and bean.orgList.size() > 0'>
|
2024-12-20 15:08:28 +08:00
|
|
|
and suo.org_id in (
|
2024-12-02 11:13:48 +08:00
|
|
|
<foreach collection="bean.orgList" item="item" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
2024-12-20 15:08:28 +08:00
|
|
|
ORDER BY la.update_time DESC
|
2024-12-02 11:13:48 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectHolidayById" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
user_id,
|
|
|
|
|
user_name,
|
|
|
|
|
org_id,
|
|
|
|
|
org_name,
|
|
|
|
|
create_time,
|
|
|
|
|
leave_type,
|
|
|
|
|
leave_reason,
|
|
|
|
|
leave_start_date,
|
|
|
|
|
leave_start_interval,
|
|
|
|
|
leave_end_date,
|
|
|
|
|
leave_end_interval,
|
|
|
|
|
leave_duration,
|
|
|
|
|
examine_status,
|
|
|
|
|
examine_opinion,
|
|
|
|
|
is_agree, location, host_user_id, remark
|
|
|
|
|
FROM
|
|
|
|
|
leave_apply
|
|
|
|
|
WHERE
|
|
|
|
|
id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getLeaveType" resultType="java.util.Map">
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getOrgList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
|
|
|
|
SELECT
|
|
|
|
|
`id`,
|
|
|
|
|
org_name as `name`
|
|
|
|
|
FROM
|
|
|
|
|
sys_organization
|
|
|
|
|
WHERE
|
|
|
|
|
is_active = '1'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getPersonList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
|
|
|
|
SELECT
|
|
|
|
|
user_id as `id`,
|
|
|
|
|
user_name as `name`
|
|
|
|
|
FROM
|
|
|
|
|
sys_user
|
|
|
|
|
WHERE
|
|
|
|
|
is_active = '1'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getLeaveTypeList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
|
|
|
|
SELECT
|
|
|
|
|
dict_code as `id`,
|
|
|
|
|
dict_label as `name`
|
|
|
|
|
FROM
|
|
|
|
|
sys_dict_data
|
|
|
|
|
WHERE
|
|
|
|
|
dict_type = 'att_status' and dict_code > 47
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getUserIdById" resultType="java.lang.Long">
|
|
|
|
|
SELECT
|
|
|
|
|
user_id
|
|
|
|
|
FROM
|
|
|
|
|
leave_apply
|
|
|
|
|
WHERE
|
|
|
|
|
id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getHolidayData" resultType="com.bonus.system.holiday.entity.HolidayImportBean">
|
|
|
|
|
SELECT
|
|
|
|
|
user_name,leave_start_date,leave_end_date
|
|
|
|
|
FROM
|
|
|
|
|
leave_apply
|
|
|
|
|
WHERE leave_end_date > #{previousMonthDate}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|