|
@@ -1,6 +1,9 @@
|
|
|
<?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="SapCheckMapper">
|
|
|
+ <select id="selectCheckUserList" resultType="String">
|
|
|
+ SELECT userId from sap_check_user
|
|
|
+ </select>
|
|
|
<update id="truncateCheckin">
|
|
|
truncate table sap_checkin
|
|
|
</update>
|
|
@@ -59,43 +62,25 @@
|
|
|
d.checkinDate as checkoffDate,d.exceptionType as checkoffException,e.checkinDate as checkoutDate1,g.checkinDate as checkoutDate2,
|
|
|
f.createdDateTime as leaveCreatedTime, f.startDate as leaveStartDate,
|
|
|
f.endDate as leaveEndDate,f.deductionQuantity as leaveDay,f.`comment` as leaveComment, '正常' as result
|
|
|
- from sap_user a join sap_checkdate b on a.result = 'SUCCESS' and a.isPrimary = 1 and a.delFlag = 0 and b.weekday = 1
|
|
|
+ from sap_check_user a join sap_checkdate b on b.weekday = 1
|
|
|
LEFT JOIN sap_checkin c on a.userId = c.userId and b.checkinDay = c.checkinDay
|
|
|
LEFT JOIN sap_checkoff d on a.userId = d.userId and b.checkinDay = d.checkinDay
|
|
|
LEFT JOIN sap_checkout_start e on a.userId = e.userId and b.checkinDay = e.checkinDay
|
|
|
LEFT JOIN sap_checkout_end g on a.userId = g.userId and b.checkinDay = g.checkinDay
|
|
|
LEFT JOIN sap_employee_time f on a.userId = f.userId and b.checkinDay = f.startDate and f.approvalStatus = 'APPROVED'
|
|
|
where EXISTS (SELECT 1 from sap_checkin_option o where a.userId = o.userId)
|
|
|
- order by a.sortNumber ASC, b.checkinDay asc;
|
|
|
+ order by a.userId ASC, b.checkinDay asc;
|
|
|
</insert>
|
|
|
- <update id="truncateCheckReportUser">
|
|
|
- truncate table sap_check_report_user
|
|
|
+ <update id="dropCheckReportUser">
|
|
|
+ drop table sap_check_report_user
|
|
|
</update>
|
|
|
<insert id="saveCheckReportUser">
|
|
|
- insert into sap_check_report_user
|
|
|
+ create table sap_check_report_user
|
|
|
SELECT a.userId, a.name,
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-01' then a.result else '' end ),',','') as '2020-04-01',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-02' then a.result else '' end ),',','') as '2020-04-02',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-03' then a.result else '' end ),',','') as '2020-04-03',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-07' then a.result else '' end ),',','') as '2020-04-07',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-08' then a.result else '' end ),',','') as '2020-04-08',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-09' then a.result else '' end ),',','') as '2020-04-09',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-10' then a.result else '' end ),',','') as '2020-04-10',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-13' then a.result else '' end ),',','') as '2020-04-13',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-14' then a.result else '' end ),',','') as '2020-04-14',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-15' then a.result else '' end ),',','') as '2020-04-15',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-16' then a.result else '' end ),',','') as '2020-04-16',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-17' then a.result else '' end ),',','') as '2020-04-17',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-20' then a.result else '' end ),',','') as '2020-04-20',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-21' then a.result else '' end ),',','') as '2020-04-21',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-22' then a.result else '' end ),',','') as '2020-04-22',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-23' then a.result else '' end ),',','') as '2020-04-23',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-24' then a.result else '' end ),',','') as '2020-04-24',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-26' then a.result else '' end ),',','') as '2020-04-26',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-27' then a.result else '' end ),',','') as '2020-04-27',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-28' then a.result else '' end ),',','') as '2020-04-28',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-29' then a.result else '' end ),',','') as '2020-04-29',
|
|
|
- replace(group_concat(case when a.checkinDay = '2020-04-30' then a.result else '' end ),',','') as '2020-04-30'
|
|
|
+ replace(group_concat(case when a.checkinDay = '2020-05-06' then a.result else '' end ),',','') as '2020-05-06',
|
|
|
+ replace(group_concat(case when a.checkinDay = '2020-05-07' then a.result else '' end ),',','') as '2020-05-07',
|
|
|
+ replace(group_concat(case when a.checkinDay = '2020-05-08' then a.result else '' end ),',','') as '2020-05-08',
|
|
|
+ replace(group_concat(case when a.checkinDay = '2020-05-09' then a.result else '' end ),',','') as '2020-05-09'
|
|
|
from sap_check_report a group by a.userId, a.name;
|
|
|
</insert>
|
|
|
<update id="truncateCheckOption">
|
|
@@ -127,6 +112,10 @@
|
|
|
SELECT * from sap_check_report where result = '异常' and checkoutDate1 is not null;
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectExceptionList" resultType="SapCheckReport">
|
|
|
+ SELECT * from sap_check_report where result = '异常'
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectRepeatCheckin" resultType="SapCheck">
|
|
|
SELECT a.* from sap_checkin a, (SELECT userId, checkinDay from sap_checkin GROUP BY userId, checkinDay having count(1) > 1) b
|
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay order by a.exceptionType, a.checkinDate;
|