186 lines
6.1 KiB
XML
186 lines
6.1 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.holiday.dao.HolidayDao">
|
||
|
|
<insert id="insertHoliday">
|
||
|
|
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
|
||
|
|
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
|
||
|
|
FROM
|
||
|
|
leave_apply
|
||
|
|
WHERE
|
||
|
|
is_active = '1'
|
||
|
|
<if test="bean.leaveDate != null and bean.leaveDate != '' ">
|
||
|
|
and locate(#{bean.leaveDate},create_time)
|
||
|
|
</if>
|
||
|
|
<if test="bean.examineStatus != null and bean.examineStatus != '' ">
|
||
|
|
and examine_status = #{bean.examineStatus}
|
||
|
|
</if>
|
||
|
|
<if test="bean.leaveType != null and bean.leaveType != '' ">
|
||
|
|
and locate(#{bean.leaveType},leave_type)
|
||
|
|
</if>
|
||
|
|
<if test="bean.type != null and bean.type != '' ">
|
||
|
|
and locate(#{bean.type},type)
|
||
|
|
</if>
|
||
|
|
<if test="bean.orgName != null and bean.orgName != '' ">
|
||
|
|
and locate(#{bean.orgName},org_name)
|
||
|
|
</if>
|
||
|
|
<if test="bean.userName != null and bean.userName != '' ">
|
||
|
|
and locate(#{bean.userName},user_name)
|
||
|
|
</if>
|
||
|
|
<if test="bean.userId != null and bean.userId != '' ">
|
||
|
|
and (user_id = #{bean.userId} or create_user_id = #{bean.userId} )
|
||
|
|
</if>
|
||
|
|
<if test='bean.orgList != null and bean.orgList.size() > 0'>
|
||
|
|
and org_id in (
|
||
|
|
<foreach collection="bean.orgList" item="item" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
ORDER BY update_time DESC
|
||
|
|
</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>
|