|
@@ -79,76 +79,73 @@
|
|
|
<update id="updateWorkTime">
|
|
|
update sap_check_report a, sap_checkin_option b
|
|
|
set a.workTime = b.workTime
|
|
|
- where a.userId = b.userId and a.workTime is null
|
|
|
+ where a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateOffWorkTime">
|
|
|
update sap_check_report a, sap_checkin_option b
|
|
|
set a.offWorkTime = b.offWorkTime
|
|
|
- where a.userId = b.userId and a.offWorkTime is null
|
|
|
+ where a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateNoNeedOffwork">
|
|
|
update sap_check_report a, sap_checkin_option b
|
|
|
set a.noNeedOffwork = b.noNeedOffwork
|
|
|
- where a.userId = b.userId and a.noNeedOffwork is null
|
|
|
+ where a.userId = b.userId and a.noNeedOffwork is null and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateNoNeedOffworkDefault">
|
|
|
- update sap_check_report set noNeedOffwork = 0 where noNeedOffwork is null
|
|
|
+ update sap_check_report a
|
|
|
+ set a.noNeedOffwork = 0
|
|
|
+ where a.noNeedOffwork is null and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateCheckinNullException">
|
|
|
- update sap_check_report set checkinException = '后台更新未打卡' where checkinDate is null
|
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
+ update sap_check_report a
|
|
|
+ set a.checkinException = '后台更新未打卡'
|
|
|
+ where a.checkinDate is null and a.workTime is not null and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateCheckoffNullException">
|
|
|
- update sap_check_report set checkoffException = '后台更新未打卡' where checkoffDate is null
|
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
+ update sap_check_report a
|
|
|
+ set a.checkoffException = '后台更新未打卡'
|
|
|
+ where a.checkoffDate is null and a.workTime is not null and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
- <update id="updateResultOk">
|
|
|
- update sap_check_report set result = '正常'
|
|
|
- where id = #{id}
|
|
|
- </update>
|
|
|
-
|
|
|
<update id="updateBuKaDay">
|
|
|
update sap_check_report a, sap_approval_info b
|
|
|
set a.bukaDay = b.`day`
|
|
|
- where a.checkinDay = b.`day` and a.userId = b.userId
|
|
|
- and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
+ where a.checkinDay = b.`day` and a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateLeaveTime">
|
|
|
update sap_check_report a ,sap_employee_time f
|
|
|
- SET a.leaveCreatedTime = f.createdDateTime,
|
|
|
- a.leaveStartDate = f.startDate, a.leaveEndDate = f.endDate,
|
|
|
+ SET a.leaveCreatedTime = f.createdDateTime, a.leaveStartDate = f.startDate, a.leaveEndDate = f.endDate,
|
|
|
a.leaveDay = f.deductionQuantity, a.leaveComment =f.`comment`
|
|
|
where a.userId = f.userId and a.checkinDay >= f.startDate and a.checkinDay <= f.endDate
|
|
|
- and f.approvalStatus = 'APPROVED' and f.delFlag=0
|
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
+ and f.approvalStatus = 'APPROVED' and f.delFlag=0 and a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateAllHour">
|
|
|
- update sap_check_report set hour = #{hour}
|
|
|
+ update sap_check_report
|
|
|
+ set hour = #{hour}
|
|
|
where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealCheckinDate">
|
|
|
- update sap_check_report
|
|
|
- set realCheckinDate = (
|
|
|
+ update sap_check_report a
|
|
|
+ set a.realCheckinDate = (
|
|
|
case when checkinException not like '%未打卡' and checkinDate is not null then checkinDate
|
|
|
when checkoutDate1 is not null and checkoutDate1 < concat(checkinDay,' 13:00:00') then checkoutDate1
|
|
|
else ''
|
|
|
end
|
|
|
)
|
|
|
- where realCheckinDate is null
|
|
|
+ where a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealCheckoffDate">
|
|
|
- update sap_check_report
|
|
|
- set realCheckoffDate = (
|
|
|
+ update sap_check_report a
|
|
|
+ set a.realCheckoffDate = (
|
|
|
case when noNeedOffwork = 1 then concat(checkinDay,' ',offWorkTime,':00')
|
|
|
when checkoutDate2 is not null and checkoutDate2 > concat(checkinDay,' 12:00:00') then checkoutDate2
|
|
|
when checkoutDate1 is not null and checkoutDate1 > concat(checkinDay,' 12:00:00') then checkoutDate1
|
|
@@ -156,16 +153,18 @@
|
|
|
else ''
|
|
|
end
|
|
|
)
|
|
|
- where realCheckoffDate is null
|
|
|
+ where a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateCheckoffExceptionByNoNeedOffwork">
|
|
|
- update sap_check_report set checkoffException = '' where noNeedOffwork = 1;
|
|
|
+ update sap_check_report
|
|
|
+ set checkoffException = ''
|
|
|
+ where noNeedOffwork = 1 and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealResultRemark">
|
|
|
- update sap_check_report
|
|
|
- set realResultRemark = concat((
|
|
|
+ update sap_check_report a
|
|
|
+ set a.realResultRemark = concat((
|
|
|
case when realCheckinDate = '' then '上班未打卡,'
|
|
|
when realCheckinDate != '' and left(realCheckinDate, 16) > concat(checkinDay,' ', workTime) then '迟到,'
|
|
|
else ''
|
|
@@ -176,12 +175,12 @@
|
|
|
else ''
|
|
|
end
|
|
|
))
|
|
|
- where realResultRemark is null
|
|
|
+ where a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay} and a.workTime is not null
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealResult">
|
|
|
- update sap_check_report
|
|
|
- set realResult = (
|
|
|
+ update sap_check_report a
|
|
|
+ set a.realResult = (
|
|
|
case when length(realResultRemark) = 0 then '正常'
|
|
|
when leaveDay >= 1 or (leaveDay = 0.5 and (
|
|
|
(realCheckinDate != '' and left(realCheckinDate, 16) <= concat(checkinDay,' ', workTime))
|
|
@@ -189,15 +188,19 @@
|
|
|
(realCheckoffDate != '' and left(realCheckoffDate, 16) >= concat(checkinDay,' ', offWorkTime))
|
|
|
)) then '已申请休假' else '异常'
|
|
|
end)
|
|
|
- where realResult is null
|
|
|
+ where a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealResultRemarkOK">
|
|
|
- update sap_check_report set realResultRemark = '' where realResult = '正常'
|
|
|
+ update sap_check_report
|
|
|
+ set realResultRemark = ''
|
|
|
+ where realResult = '正常' and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateRealResultRemarkLeave">
|
|
|
- update sap_check_report set realResultRemark = '已申请休假', realResult = '正常' where realResult = '已申请休假'
|
|
|
+ update sap_check_report
|
|
|
+ set realResultRemark = '已申请休假', realResult = '正常'
|
|
|
+ where realResult = '已申请休假' and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateWorkMins">
|
|
@@ -208,17 +211,19 @@
|
|
|
else ''
|
|
|
end
|
|
|
)
|
|
|
- where workMins is null
|
|
|
+ where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateWorkMinsZero">
|
|
|
- update sap_check_report set workMins = 0 where workMins < 0
|
|
|
+ update sap_check_report
|
|
|
+ set workMins = 0
|
|
|
+ where workMins < 0 and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateWorkHours">
|
|
|
update sap_check_report
|
|
|
set workHours = ROUND(workMins / 60, 1)
|
|
|
- where workHours is null
|
|
|
+ where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
</update>
|
|
|
|
|
|
<select id="selectRepeatCheckin" resultType="SapCheck">
|