|
@@ -1,28 +1,72 @@
|
|
|
<?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">
|
|
|
+ <update id="truncateCheckin">
|
|
|
+ truncate table sap_checkin
|
|
|
+ </update>
|
|
|
<insert id="saveCheckin">
|
|
|
insert into sap_checkin(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
|
checkinTime,locationTitle,locationDetail,wifiName,wifiMac)
|
|
|
values (#{userId},#{groupName},#{checkinType},#{checkinDate},#{checkinDay},#{exceptionType},
|
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
|
</insert>
|
|
|
-
|
|
|
+ <update id="truncateCheckoff">
|
|
|
+ truncate table sap_checkoff
|
|
|
+ </update>
|
|
|
<insert id="saveCheckoff">
|
|
|
insert into sap_checkoff(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
|
checkinTime,locationTitle,locationDetail,wifiName,wifiMac)
|
|
|
values (#{userId},#{groupName},#{checkinType},#{checkinDate},#{checkinDay},#{exceptionType},
|
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
|
</insert>
|
|
|
-
|
|
|
+ <update id="truncateCheckout">
|
|
|
+ truncate table sap_checkout
|
|
|
+ </update>
|
|
|
<insert id="saveCheckout">
|
|
|
insert into sap_checkout(userId,groupName,checkinType,checkinDate,checkinDay,exceptionType,
|
|
|
checkinTime,locationTitle,locationDetail,wifiName,wifiMac)
|
|
|
values (#{userId},#{groupName},#{checkinType},#{checkinDate},#{checkinDay},#{exceptionType},
|
|
|
#{checkinTime},#{locationTitle},#{locationDetail},#{wifiName},#{wifiMac})
|
|
|
</insert>
|
|
|
-
|
|
|
-
|
|
|
+ <update id="truncateCheckoutStart">
|
|
|
+ truncate table sap_checkout_start
|
|
|
+ </update>
|
|
|
+ <insert id="saveCheckoutStart1">
|
|
|
+ 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
|
|
|
+ where a.userId = b.userId and a.checkinDay = b.checkinDay
|
|
|
+ </insert>
|
|
|
+ <insert id="saveCheckoutStart2">
|
|
|
+ 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
|
|
|
+ where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
|
+ </insert>
|
|
|
+ <update id="truncateCheckoutEnd">
|
|
|
+ truncate table sap_checkout_end
|
|
|
+ </update>
|
|
|
+ <insert id="saveCheckoutEnd">
|
|
|
+ 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
|
|
|
+ where a.userId = b.userId and a.checkinDay = b.checkinDay and a.checkinDate = b.checkinDate ORDER BY a.userId, a.checkinDay, a.checkinDate;
|
|
|
+ </insert>
|
|
|
+ <update id="truncateCheckReport">
|
|
|
+ truncate table sap_check_report
|
|
|
+ </update>
|
|
|
+ <insert id="saveCheckReport">
|
|
|
+ insert into sap_check_report(userId,groupName,workTime,offWorkTime,name,checkinDay,checkinDate,checkinException,checkoffDate,checkoffException,
|
|
|
+ checkoutDate1,checkoutDate2,leaveCreatedTime,leaveStartDate,leaveEndDate,leaveDay,leaveComment,result)
|
|
|
+ select a.userId,c.groupName,'9:30','18:30',a.`name`,b.checkinDay, c.checkinDate as checkinDate,c.exceptionType as checkinException,
|
|
|
+ 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
|
|
|
+ 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'
|
|
|
+ order by a.sortNumber ASC, b.checkinDay asc;
|
|
|
+ </insert>
|
|
|
<insert id="saveCheckinOption">
|
|
|
insert into sap_checkin_option(userId,workSec,offWorkSec,workTime,offWorkTime)
|
|
|
values (#{userId},#{workSec},#{offWorkSec},#{workTime},#{offWorkTime})
|
|
@@ -48,4 +92,40 @@
|
|
|
<select id="selectCheckoutList" resultType="SapCheckReport">
|
|
|
SELECT * from sap_check_report where result = '异常' and checkoutDate1 is not null;
|
|
|
</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;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectRepeatCheckoff" resultType="SapCheck">
|
|
|
+ SELECT a.* from sap_checkoff a, (SELECT userId, checkinDay from sap_checkoff 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;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectRepeatCheckoutStart" resultType="SapCheck">
|
|
|
+ SELECT a.* from sap_checkout_start a, (SELECT userId, checkinDay from sap_checkout_start 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;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectRepeatCheckoutEnd" resultType="SapCheck">
|
|
|
+ SELECT a.* from sap_checkout_end a, (SELECT userId, checkinDay from sap_checkout_end 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;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="deleteCheckin">
|
|
|
+ delete from sap_checkin where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteCheckoff">
|
|
|
+ delete from sap_checkoff where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteCheckoutStart">
|
|
|
+ delete from sap_checkout_start where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteCheckoutEnd">
|
|
|
+ delete from sap_checkout_end where id = #{id}
|
|
|
+ </update>
|
|
|
</mapper>
|