214 lines
9.5 KiB
XML
214 lines
9.5 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.att.dao.AttendanceDetailsDao">
|
|
|
|
<select id="selectAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
select su.user_name, so.org_name, v.* from v_att_update_data v
|
|
left join sys_user su on su.user_id = v.user_id
|
|
left join sys_organization so on so.id = v.org_id
|
|
where v.att_current_day BETWEEN #{startDate} AND #{endDate}
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
<if test='attStatus != null and attStatus == "6"'>
|
|
and (v.toWorkAttStatus in (12,13,14,15,16,17,18) or v.offWorkAttStatus in (12,13,14,15,16,17,18))
|
|
</if>
|
|
<if test='attStatus != null and attStatus != "6"'>
|
|
<if test='attStatus == "1"'>
|
|
and ( toWorkAttStatus = #{attStatus} and offWorkAttStatus = #{attStatus} )
|
|
</if>
|
|
<if test='attStatus != "1"'>
|
|
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
|
|
</if>
|
|
</if>
|
|
ORDER BY att_current_day DESC
|
|
</select>
|
|
|
|
<select id="exportAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
SELECT
|
|
v.user_id,
|
|
su.user_name,
|
|
GROUP_CONCAT(DISTINCT so.org_name) as orgName,
|
|
v.att_current_day,
|
|
v.toWorkAttStatus,
|
|
v.toWorkAttAddress,
|
|
v.toWorkErrorRemake,
|
|
v.offWorkAttStatus,
|
|
v.offWorkAttAddress,
|
|
v.offWorkErrorRemake
|
|
FROM
|
|
v_att_update_data v
|
|
LEFT JOIN sys_user su ON su.user_id = v.user_id
|
|
LEFT JOIN sys_organization so ON so.id = v.org_id
|
|
WHERE
|
|
v.att_current_day BETWEEN #{startDate} AND #{endDate} and su.is_active = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
<if test="attStatus != null and attStatus != ''">
|
|
AND v.toWorkAttStatus = #{attStatus} AND v.offWorkAttStatus = #{attStatus}
|
|
</if>
|
|
GROUP BY v.user_id,v.att_current_day
|
|
ORDER BY CHAR_LENGTH(GROUP_CONCAT(DISTINCT so.org_name)) DESC
|
|
</select>
|
|
|
|
<select id="exportAttOriginalsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
SELECT
|
|
v.user_id,
|
|
su.user_name,
|
|
GROUP_CONCAT(DISTINCT so.org_name) as orgName,
|
|
v.att_current_day,
|
|
v.toWorkAttStatus,
|
|
v.toWorkAttAddress,
|
|
v.toWorkErrorRemake,
|
|
v.offWorkAttStatus,
|
|
v.offWorkAttAddress,
|
|
v.offWorkErrorRemake
|
|
FROM
|
|
v_att_data v
|
|
LEFT JOIN sys_user su ON su.user_id = v.user_id
|
|
LEFT JOIN sys_organization so ON so.id = v.org_id
|
|
WHERE
|
|
v.att_current_day BETWEEN #{startDate} AND #{endDate} and su.is_active = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
<if test="attStatus != null and attStatus != ''">
|
|
AND v.toWorkAttStatus = #{attStatus} AND v.offWorkAttStatus = #{attStatus}
|
|
</if>
|
|
GROUP BY v.user_id,v.att_current_day
|
|
ORDER BY CHAR_LENGTH(GROUP_CONCAT(DISTINCT so.org_name)) DESC
|
|
</select>
|
|
|
|
<select id="selectAttOriginalList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
select su.user_name, so.org_name, v.* from v_att_data v
|
|
left join sys_user su on su.user_id = v.user_id
|
|
left join sys_organization so on so.id = v.org_id
|
|
where v.att_current_day BETWEEN #{startDate} AND #{endDate} and su.is_active = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
<if test="attStatus != null and attStatus != ''">
|
|
AND (v.toWorkAttStatus = #{attStatus} OR v.offWorkAttStatus = #{attStatus})
|
|
</if>
|
|
ORDER BY att_current_day DESC
|
|
</select>
|
|
|
|
<select id="selectAttUpdateList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
select su.user_name, so.org_name, v.* from v_att_update_data v
|
|
left join sys_user su on su.user_id = v.user_id
|
|
left join sys_organization so on so.id = v.org_id
|
|
where v.att_current_day BETWEEN #{startDate} AND #{endDate} and v.is_update = 1 and su.is_active = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test='orgList != null and orgList.size() > 0'>
|
|
and v.org_id in (
|
|
<foreach collection="orgList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="userId != null and userId != ''">
|
|
AND v.user_id = #{userId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
<if test="attStatus != null and attStatus != ''">
|
|
AND v.toWorkAttStatus = #{attStatus} AND v.offWorkAttStatus = #{attStatus}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getAttDayReportList" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
|
select *
|
|
from att_day_report
|
|
where att_current_day BETWEEN #{startDate} AND #{endDate}
|
|
</select>
|
|
|
|
<select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
|
select v.*, v.name as userName from att_month_report v
|
|
left join att_group_person_relation p on p.user_id = v.user_id and p.is_active = 1
|
|
where v.att_current_month = #{month} and p.group_id is not null
|
|
<if test="orgId != null and orgId != ''">
|
|
AND v.org_id = #{orgId}
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND v.name like concat('%', #{userName}, '%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getAttDayReportDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
|
select su.user_name, so.org_name, v.* from v_att_update_data v
|
|
left join sys_user su on su.user_id = v.user_id
|
|
left join sys_organization so on so.id = v.org_id
|
|
<where>
|
|
<if test="attCurrentDay != null and attCurrentDay != ''">
|
|
AND att_current_day = #{attCurrentDay}
|
|
</if>
|
|
<if test="startDate != null and startDate != ''">
|
|
AND att_current_day between #{startDate} AND #{endDate}
|
|
</if>
|
|
<if test='attStatus != null and attStatus == "6"'>
|
|
and (toWorkAttStatus in (12,13,14,15,16,17,18) or offWorkAttStatus in (12,13,14,15,16,17,18))
|
|
</if>
|
|
<if test='attStatus != null and attStatus != "6"'>
|
|
<if test='attStatus == "1"'>
|
|
and ( toWorkAttStatus = #{attStatus} and offWorkAttStatus = #{attStatus} )
|
|
</if>
|
|
<if test='attStatus != "1"'>
|
|
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
|
|
</if>
|
|
</if>
|
|
<if test="userName != null and userName != ''">
|
|
AND su.user_name like concat('%', #{userName}, '%')
|
|
</if>
|
|
</where>
|
|
ORDER BY att_current_day DESC
|
|
</select>
|
|
|
|
|
|
<update id="updateAttDetailsData">
|
|
<foreach collection="list" item="params" separator=";">
|
|
update att_data_update set update_att_current_time = #{params.toWorkAttCurrentTime},
|
|
update_att_status = #{params.toWorkAttStatus}, reviewer_status = 0, is_update = 1,
|
|
reason_content = #{params.toErrorRemake}
|
|
where user_id = #{params.userId} and org_id = #{params.orgId} and att_type = 1
|
|
and att_current_day = #{params.attCurrentDay};
|
|
|
|
update att_data_update set update_att_current_time = #{params.offWorkAttCurrentTime},
|
|
update_att_status = #{params.offWorkAttStatus}, reviewer_status = 0, is_update = 1,
|
|
reason_content = #{params.offErrorRemake}
|
|
where user_id = #{params.userId} and org_id = #{params.orgId} and att_type = 2
|
|
and att_current_day = #{params.attCurrentDay}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="updateAttDetailsDataExamine">
|
|
<foreach collection="list" item="params" separator=";">
|
|
update att_data_update set reviewer_status = #{params.reviewerStatus},
|
|
reviewer_user_id = #{params.reviewerUserId}, reviewer_time = #{params.reviewerTime}
|
|
where user_id = #{params.userId} and org_id = #{params.orgId} and att_type = 1
|
|
and att_current_day = #{params.attCurrentDay};
|
|
|
|
update att_data_update set reviewer_status = #{params.reviewerStatus},
|
|
reviewer_user_id = #{params.reviewerUserId}, reviewer_time = #{params.reviewerTime}
|
|
where user_id = #{params.userId} and org_id = #{params.orgId} and att_type = 2
|
|
and att_current_day = #{params.attCurrentDay}
|
|
</foreach>
|
|
</update>
|
|
</mapper> |