|
@@ -2,7 +2,7 @@
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="SapCheckMapper">
|
|
<mapper namespace="SapCheckMapper">
|
|
<update id="deleteCheckinList">
|
|
<update id="deleteCheckinList">
|
|
- delete from sap_checkin where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
|
|
+ truncate table sap_checkin
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckin">
|
|
<insert id="saveCheckin">
|
|
insert into sap_checkin(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
insert into sap_checkin(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
@@ -11,7 +11,7 @@
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
</insert>
|
|
</insert>
|
|
<update id="deleteCheckoffList">
|
|
<update id="deleteCheckoffList">
|
|
- delete from sap_checkoff where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
|
|
+ truncate table sap_checkoff
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckoff">
|
|
<insert id="saveCheckoff">
|
|
insert into sap_checkoff(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
insert into sap_checkoff(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
@@ -20,7 +20,7 @@
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
</insert>
|
|
</insert>
|
|
<update id="deleteCheckoutList">
|
|
<update id="deleteCheckoutList">
|
|
- delete from sap_checkout where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
|
|
+ truncate table sap_checkout
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckout">
|
|
<insert id="saveCheckout">
|
|
insert into sap_checkout(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
insert into sap_checkout(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
@@ -28,34 +28,33 @@
|
|
values (#{userId},#{groupName},#{checkinType},#{checkinDate},#{checkinDay},#{exceptionType},
|
|
values (#{userId},#{groupName},#{checkinType},#{checkinDate},#{checkinDay},#{exceptionType},
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
</insert>
|
|
</insert>
|
|
- <update id="deleteCheckoutStart">
|
|
|
|
- delete from sap_checkout_start where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
|
|
+ <update id="deleteCheckoutStartList">
|
|
|
|
+ truncate table sap_checkout_start
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckoutStart1">
|
|
<insert id="saveCheckoutStart1">
|
|
insert into sap_checkout_start
|
|
insert into sap_checkout_start
|
|
SELECT a.* from sap_checkout a, (SELECT userId, checkinDay from sap_checkout GROUP BY userId, checkinDay having count(1) = 1) b
|
|
SELECT a.* from sap_checkout a, (SELECT userId, checkinDay from sap_checkout GROUP BY userId, checkinDay having count(1) = 1) b
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
</insert>
|
|
</insert>
|
|
<insert id="saveCheckoutStart2">
|
|
<insert id="saveCheckoutStart2">
|
|
insert into sap_checkout_start
|
|
insert into sap_checkout_start
|
|
- SELECT a.* from sap_checkout a, (SELECT userId, checkinDay,min(checkinDate) as checkinDate from sap_checkout GROUP BY userId, checkinDay having count(1) > 1) b
|
|
|
|
|
|
+ SELECT a.* from sap_checkout a, (SELECT userId, checkinDay,min(checkinDate) as checkinDate from sap_checkout
|
|
|
|
+ GROUP BY userId, checkinDay having count(1) > 1) b
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
</insert>
|
|
</insert>
|
|
- <update id="deleteCheckoutEnd">
|
|
|
|
- delete from sap_checkout_end where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
|
|
+ <update id="deleteCheckoutEndList">
|
|
|
|
+ truncate table sap_checkout_end
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckoutEnd">
|
|
<insert id="saveCheckoutEnd">
|
|
insert into sap_checkout_end
|
|
insert into sap_checkout_end
|
|
- SELECT a.* from sap_checkout a, (SELECT userId, checkinDay,max(checkinDate) as checkinDate from sap_checkout GROUP BY userId, checkinDay having count(1) > 1) b
|
|
|
|
|
|
+ SELECT a.* from sap_checkout a, (SELECT userId, checkinDay,max(checkinDate) as checkinDate from sap_checkout
|
|
|
|
+ GROUP BY userId, checkinDay having count(1) > 1) b
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate
|
|
where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate
|
|
- and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
|
|
ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
</insert>
|
|
</insert>
|
|
- <update id="truncateCheckReport">
|
|
|
|
- truncate table sap_check_report
|
|
|
|
|
|
+ <update id="deleteCheckReport">
|
|
|
|
+ delete from sap_check_report where checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckReport">
|
|
<insert id="saveCheckReport">
|
|
insert into sap_check_report(userId,groupName,workTime,offWorkTime,name,checkinDay,checkinDate,checkinException,checkoffDate,checkoffException,
|
|
insert into sap_check_report(userId,groupName,workTime,offWorkTime,name,checkinDay,checkinDate,checkinException,checkoffDate,checkoffException,
|
|
@@ -64,7 +63,8 @@
|
|
d.checkinDate as checkoffDate,d.exceptionType as checkoffException,e.checkinDate as checkoutDate1,g.checkinDate as checkoutDate2,
|
|
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.createdDateTime as leaveCreatedTime, f.startDate as leaveStartDate,
|
|
f.endDate as leaveEndDate,f.deductionQuantity as leaveDay,f.`comment` as leaveComment, m.`day` as bukaDay, '正常' as result
|
|
f.endDate as leaveEndDate,f.deductionQuantity as leaveDay,f.`comment` as leaveComment, m.`day` as bukaDay, '正常' as result
|
|
- from wx_user a join sap_checkdate b on b.weekday = 1
|
|
|
|
|
|
+ from wx_user a join sap_checkdate b on b.weekday = 1 and a.delFlag=0
|
|
|
|
+ and b.checkinDay >= #{startDay} and b.checkinDay <= #{endDay}
|
|
LEFT JOIN sap_checkin c on a.userId = c.userId and b.checkinDay = c.checkinDay
|
|
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_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_start e on a.userId = e.userId and b.checkinDay = e.checkinDay
|
|
@@ -75,34 +75,40 @@
|
|
order by a.userId ASC, b.checkinDay asc;
|
|
order by a.userId ASC, b.checkinDay asc;
|
|
</insert>
|
|
</insert>
|
|
<update id="dropCheckReportUser">
|
|
<update id="dropCheckReportUser">
|
|
- drop table sap_check_report_user
|
|
|
|
|
|
+ drop table if exists sap_check_report_${startDayT}_${endDayT}
|
|
</update>
|
|
</update>
|
|
<insert id="saveCheckReportUser">
|
|
<insert id="saveCheckReportUser">
|
|
- create table sap_check_report_user
|
|
|
|
|
|
+ create table sap_check_report_${startDayT}_${endDayT}
|
|
SELECT a.userId, a.name,
|
|
SELECT a.userId, a.name,
|
|
replace(group_concat(case when a.checkinDay = '2020-05-11' then a.result else '' end ),',','') as '2020-05-11',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-11' then a.result else '' end ),',','') as '2020-05-11',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-12' then a.result else '' end ),',','') as '2020-05-12',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-12' then a.result else '' end ),',','') as '2020-05-12',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-13' then a.result else '' end ),',','') as '2020-05-13',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-13' then a.result else '' end ),',','') as '2020-05-13',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-14' then a.result else '' end ),',','') as '2020-05-14',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-14' then a.result else '' end ),',','') as '2020-05-14',
|
|
replace(group_concat(case when a.checkinDay = '2020-05-15' then a.result else '' end ),',','') as '2020-05-15'
|
|
replace(group_concat(case when a.checkinDay = '2020-05-15' then a.result else '' end ),',','') as '2020-05-15'
|
|
- from sap_check_report a group by a.userId, a.name;
|
|
|
|
|
|
+ from sap_check_report a
|
|
|
|
+ where a.checkinDay >= #{startDay} and a.checkinDay <= #{endDay}
|
|
|
|
+ group by a.userId, a.name;
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<update id="updateHrsdWorkTime">
|
|
<update id="updateHrsdWorkTime">
|
|
- update sap_check_report set workTime = '10:00' where groupName like '%华人时代%'
|
|
|
|
|
|
+ update sap_check_report set workTime = '10:00' where groupName like '%华人时代%'
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<update id="updateCheckinException">
|
|
<update id="updateCheckinException">
|
|
- update sap_check_report set checkinException = '未打卡后台更新' where checkinDate is null
|
|
|
|
|
|
+ update sap_check_report set checkinException = '未打卡后台更新' where checkinDate is null
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<update id="updateCheckoffException">
|
|
<update id="updateCheckoffException">
|
|
update sap_check_report set checkoffException = '未打卡后台更新' where checkoffDate is null
|
|
update sap_check_report set checkoffException = '未打卡后台更新' where checkoffDate is null
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<update id="updateAllExceptionResult">
|
|
<update id="updateAllExceptionResult">
|
|
update sap_check_report set result = '异常'
|
|
update sap_check_report set result = '异常'
|
|
- where (LENGTH(checkinException) > 0 or LENGTH(checkoffException) > 0) and result = '正常'
|
|
|
|
|
|
+ where (LENGTH(checkinException) > 0 or LENGTH(checkoffException) > 0) and result = '正常'
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<update id="updateResultOk">
|
|
<update id="updateResultOk">
|
|
@@ -110,15 +116,13 @@
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<select id="selectLeaveDayList" resultType="SapCheckReport">
|
|
<select id="selectLeaveDayList" resultType="SapCheckReport">
|
|
- SELECT * from sap_check_report where result = '异常' and leaveDay is not null;
|
|
|
|
- </select>
|
|
|
|
-
|
|
|
|
- <select id="selectCheckoutList" resultType="SapCheckReport">
|
|
|
|
- SELECT * from sap_check_report where result = '异常' and checkoutDate1 is not null;
|
|
|
|
|
|
+ SELECT * from sap_check_report where result = '异常' and leaveDay is not null
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="selectExceptionList" resultType="SapCheckReport">
|
|
<select id="selectExceptionList" resultType="SapCheckReport">
|
|
- SELECT * from sap_check_report where result = '异常'
|
|
|
|
|
|
+ SELECT * from sap_check_report where result = '异常'
|
|
|
|
+ and checkinDay >= #{startDay} and checkinDay <= #{endDay}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="selectRepeatCheckin" resultType="SapCheck">
|
|
<select id="selectRepeatCheckin" resultType="SapCheck">
|