2024-12-02 11:13:48 +08:00
|
|
|
<?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.AttSourceDataDao">
|
|
|
|
|
|
|
|
|
|
<insert id="insertAttSourceData">
|
|
|
|
|
<foreach collection="list" item="params" separator=";">
|
|
|
|
|
replace into att_source_data(name, id_number, org_id, org_name, att_current_day,
|
2025-01-23 18:22:02 +08:00
|
|
|
att_current_time, att_type, att_address, att_lon, att_lat, data_source, remark)
|
2024-12-02 11:13:48 +08:00
|
|
|
values (#{params.name}, #{params.idNumber}, #{params.orgId}, #{params.orgName},
|
|
|
|
|
#{params.attCurrentDay}, #{params.attCurrentTime}, #{params.attType},
|
2025-01-23 18:22:02 +08:00
|
|
|
#{params.attAddress}, #{params.attLon}, #{params.attLat}, #{params.dataSource}, #{params.remark})
|
2024-12-02 11:13:48 +08:00
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertAttData">
|
|
|
|
|
insert into att_data(user_id, org_id, att_current_day, att_status, att_type)
|
|
|
|
|
values (#{userId}, #{orgId}, #{attCurrentDay}, #{attStatus}, #{attType})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertAttDayReport">
|
|
|
|
|
<foreach collection="list" item="params" separator=";">
|
|
|
|
|
replace into att_day_report(att_current_day, org_id, normal_num, late_num, early_num, skipping_num,
|
|
|
|
|
leave_num, address_error_num, ein_error_num, rest_num, out_num)
|
|
|
|
|
values (#{params.attCurrentDay}, #{params.orgId}, #{params.normalNum}, #{params.lateNum},
|
|
|
|
|
#{params.earlyNum}, #{params.skippingNum}, #{params.leaveNum},
|
|
|
|
|
#{params.addressErrorNum}, #{params.einErrorNum}, #{params.restNum}, #{params.outNum})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertAttMonthReport">
|
|
|
|
|
<foreach collection="list" item="params" separator=";">
|
2025-02-12 09:36:00 +08:00
|
|
|
insert into att_month_report(user_id, name, org_id, org_name, att_current_month,
|
2024-12-02 11:13:48 +08:00
|
|
|
required_days, normal_num, late_num, early_num, skipping_num,
|
2025-01-10 23:18:13 +08:00
|
|
|
leave_num, address_error_num, ein_error_num, rest_num, out_num, business_trip_num)
|
2024-12-02 11:13:48 +08:00
|
|
|
values (#{params.userId}, #{params.userName}, #{params.orgId}, #{params.orgName},
|
|
|
|
|
#{params.attCurrentMonth}, #{params.requiredDays}, #{params.normalNum}, #{params.lateNum},
|
|
|
|
|
#{params.earlyNum}, #{params.skippingNum}, #{params.leaveNum},
|
2025-01-10 23:18:13 +08:00
|
|
|
#{params.addressErrorNum}, #{params.einErrorNum}, #{params.restNum}, #{params.outNum}, #{params.businessTripNum})
|
2024-12-02 11:13:48 +08:00
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertHoliday">
|
|
|
|
|
insert into sys_holiday(date, name, type)
|
|
|
|
|
values (#{date}, #{name}, #{type})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertAttUpdateData">
|
|
|
|
|
insert into att_data_update(user_id, org_id, att_current_day, att_status, att_type)
|
|
|
|
|
values (#{userId}, #{orgId}, #{attCurrentDay}, #{attStatus}, #{attType})
|
|
|
|
|
</insert>
|
2024-12-11 17:28:21 +08:00
|
|
|
<insert id="insertWorkAbnormal">
|
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
|
replace into att_work_abnormal(user_id, user_name,org_id, att_current_day,att_current_time, att_address)
|
2025-01-03 14:12:06 +08:00
|
|
|
values (#{item.userId}, #{item.name},#{item.orgId}, #{item.attCurrentDay}, #{item.attCurrentTime},
|
|
|
|
|
#{item.attAddress})
|
2024-12-11 17:28:21 +08:00
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
|
|
|
|
<!-- replace into att_data(user_id, org_id, att_current_day, att_current_time,-->
|
|
|
|
|
<!-- att_type, att_address, att_lon, att_lat, data_source, att_status, error_remake)-->
|
|
|
|
|
<!-- values (#{params.userId}, #{params.orgId}, #{params.attCurrentDay},-->
|
|
|
|
|
<!-- #{params.attCurrentTime}, #{params.attType}, #{params.attAddress}, #{params.attLon},-->
|
|
|
|
|
<!-- #{params.attLat}, #{params.dataSource}, #{params.attStatus}, #{params.errorRemake});-->
|
|
|
|
|
<update id="updateAttStatusData">
|
|
|
|
|
<foreach collection="list" item="params" separator=";">
|
|
|
|
|
update att_data set att_current_time = #{params.attCurrentTime},
|
|
|
|
|
att_address = #{params.attAddress}, att_lon = #{params.attLon}, att_lat = #{params.attLat},
|
|
|
|
|
data_source = #{params.dataSource},
|
2025-01-23 18:22:02 +08:00
|
|
|
error_remake = #{params.remark},
|
2024-12-02 11:13:48 +08:00
|
|
|
att_status = CASE
|
2024-12-26 11:24:17 +08:00
|
|
|
WHEN att_status in (SELECT dict_value
|
|
|
|
|
FROM sys_dict_data
|
2025-01-07 01:47:43 +08:00
|
|
|
where dict_type = 'att_status' and (is_leave = '1' or is_leave = '2') ) THEN att_status
|
2024-12-02 11:13:48 +08:00
|
|
|
ELSE #{params.attStatus}
|
|
|
|
|
END
|
|
|
|
|
where user_id = #{params.userId} and org_id = #{params.orgId}
|
|
|
|
|
AND att_current_day = #{params.attCurrentDay} and att_type = #{params.attType};
|
|
|
|
|
update att_data_update set att_current_time = #{params.attCurrentTime},
|
|
|
|
|
att_address = #{params.attAddress}, att_lon = #{params.attLon}, att_lat = #{params.attLat},
|
|
|
|
|
data_source = #{params.dataSource},
|
2025-01-23 18:22:02 +08:00
|
|
|
error_remake = #{params.remark},
|
2024-12-02 11:13:48 +08:00
|
|
|
att_status = CASE
|
2024-12-26 11:24:17 +08:00
|
|
|
WHEN att_status in (SELECT dict_value
|
|
|
|
|
FROM sys_dict_data
|
2025-01-07 01:47:43 +08:00
|
|
|
where dict_type = 'att_status' and (is_leave = '1' or is_leave = '2')) THEN att_status
|
2024-12-02 11:13:48 +08:00
|
|
|
ELSE #{params.attStatus}
|
|
|
|
|
END
|
|
|
|
|
where is_update = 0 and user_id = #{params.userId} and org_id = #{params.orgId}
|
|
|
|
|
and att_current_day = #{params.attCurrentDay} and att_type = #{params.attType}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateAttData">
|
|
|
|
|
update att_data set att_status = #{v.attStatus}
|
|
|
|
|
where user_id = #{v.userId} and org_id = #{v.orgId}
|
|
|
|
|
and att_current_day = #{v.attCurrentDay} and att_type = #{v.attType}
|
|
|
|
|
<if test='type == "1"'>
|
|
|
|
|
and att_status = 0
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateAttUpdateData">
|
|
|
|
|
update att_data_update set att_status = #{v.attStatus}
|
|
|
|
|
where is_update = 0 and user_id = #{v.userId} and org_id = #{v.orgId}
|
|
|
|
|
and att_current_day = #{v.attCurrentDay} and att_type = #{v.attType}
|
|
|
|
|
<if test='type == "1"'>
|
|
|
|
|
and att_status = 0
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<delete id="updateHisData">
|
|
|
|
|
delete
|
|
|
|
|
from att_source_data
|
|
|
|
|
where att_current_day = #{date} and data_source != 3;
|
|
|
|
|
update att_data
|
|
|
|
|
set att_current_time = null,
|
|
|
|
|
att_status = 0,
|
|
|
|
|
att_address = null,
|
|
|
|
|
att_lon = null,
|
|
|
|
|
att_lat = null
|
|
|
|
|
where att_current_day = #{date};
|
|
|
|
|
update att_data_update
|
|
|
|
|
set att_current_time = null,
|
|
|
|
|
att_status = 0,
|
|
|
|
|
att_address = null,
|
|
|
|
|
att_lon = null,
|
|
|
|
|
att_lat = null
|
|
|
|
|
where att_current_day = #{date};
|
|
|
|
|
</delete>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2024-12-26 11:24:17 +08:00
|
|
|
<delete id="delHisData">
|
2025-01-03 14:12:06 +08:00
|
|
|
delete
|
|
|
|
|
from att_source_data
|
|
|
|
|
where att_current_day = #{date} and data_source != 3;
|
|
|
|
|
delete
|
|
|
|
|
from att_data
|
|
|
|
|
where att_current_day = #{date};
|
|
|
|
|
delete
|
|
|
|
|
from att_data_update
|
|
|
|
|
where att_current_day = #{date};
|
2024-12-26 11:24:17 +08:00
|
|
|
</delete>
|
2025-02-12 09:36:00 +08:00
|
|
|
<delete id="deleteAttMonthReport">
|
|
|
|
|
delete
|
|
|
|
|
from att_month_report
|
|
|
|
|
where att_current_month = DATE_FORMAT(#{pushDate}, '%Y-%m')
|
|
|
|
|
</delete>
|
2024-12-26 11:24:17 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getQsyAttendances" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
|
|
|
|
select name, id_number, '0' as orgId, '0' as orgName,
|
|
|
|
|
attendance_date as attCurrentDay, attendance_time as attCurrentTime,
|
|
|
|
|
CASE attendance_type WHEN '上班' THEN 1 ELSE 2 END as attType,
|
|
|
|
|
'0' as attAddress, lon as attLon, lat as attLat, '1' as dataSource
|
2025-01-22 09:08:03 +08:00
|
|
|
from gz_cloud.fc_sup_attendance sup
|
2025-01-03 14:12:06 +08:00
|
|
|
where sup.attendance_date
|
|
|
|
|
<if test=' pushType == "1" '>
|
2025-01-10 23:18:13 +08:00
|
|
|
>= #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
</if>
|
|
|
|
|
<if test=' pushType == "2" '>
|
|
|
|
|
= #{pushDate}
|
|
|
|
|
</if>
|
|
|
|
|
and is_wechat != 1
|
|
|
|
|
</select>
|
2025-01-10 23:18:13 +08:00
|
|
|
<!-- -->
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getAllPerson" resultType="com.bonus.system.att.entity.AttDataBean">
|
2025-01-20 13:41:32 +08:00
|
|
|
select su.user_id, agpr.org_id, agpr.group_id, '1' as attType, '0' as attStatus
|
2025-01-03 14:12:06 +08:00
|
|
|
from sys_user su
|
2025-01-20 13:41:32 +08:00
|
|
|
left join att_setting_history agpr on agpr.user_id = su.user_id and agpr.current_day = #{pushDate}
|
|
|
|
|
where su.is_active = 1 and agpr.org_id is not null
|
2025-01-03 14:12:06 +08:00
|
|
|
union
|
2025-01-20 13:41:32 +08:00
|
|
|
select su.user_id, agpr.org_id, agpr.group_id, '2' as attType, '0' as attStatus
|
2025-01-03 14:12:06 +08:00
|
|
|
from sys_user su
|
2025-01-20 13:41:32 +08:00
|
|
|
left join att_setting_history agpr on agpr.user_id = su.user_id and agpr.current_day = #{pushDate}
|
|
|
|
|
where su.is_active = 1 and agpr.org_id is not null
|
2025-01-03 14:12:06 +08:00
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="selectAttDayReport" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
|
|
|
|
select att_current_day,
|
|
|
|
|
org_id,
|
2025-01-10 23:18:13 +08:00
|
|
|
IFNULL(sum(toWorkAttStatus = 1 and offWorkAttStatus = 1), 0) as normalNum,
|
2025-01-13 20:53:46 +08:00
|
|
|
IFNULL(sum(toWorkAttStatus = 2 or offWorkAttStatus = 2), 0) as lateNum,
|
2025-01-10 23:18:13 +08:00
|
|
|
IFNULL(sum(toWorkAttStatus = 3 or offWorkAttStatus = 3), 0) as skippingNum,
|
|
|
|
|
IFNULL(sum(toWorkAttStatus = 4 or offWorkAttStatus = 4), 0) as earlyNum,
|
|
|
|
|
IFNULL(sum(toWorkAttStatus = 5 or offWorkAttStatus = 5), 0) as restNum,
|
|
|
|
|
IFNULL(sum(toWorkAttStatus in (SELECT dict_value
|
2025-01-07 01:47:43 +08:00
|
|
|
FROM sys_dict_data
|
|
|
|
|
where dict_type = 'att_status' and is_leave = '1') or
|
2025-01-10 23:18:13 +08:00
|
|
|
offWorkAttStatus in (SELECT dict_value
|
2025-01-07 01:47:43 +08:00
|
|
|
FROM sys_dict_data
|
|
|
|
|
where dict_type = 'att_status' and is_leave = '1')), 0) as leaveNum,
|
2025-01-10 23:18:13 +08:00
|
|
|
IFNULL(sum(toWorkAttStatus = 7 or offWorkAttStatus = 7), 0) as outNum,
|
|
|
|
|
IFNULL(sum(toWorkAttStatus = 8 or offWorkAttStatus = 8), 0) as einErrorNum,
|
|
|
|
|
IFNULL(sum(toWorkAttStatus = 9 or offWorkAttStatus = 9), 0) as addressErrorNum
|
2025-01-03 14:12:06 +08:00
|
|
|
from v_att_update_data
|
|
|
|
|
where att_current_day
|
|
|
|
|
<if test=' pushType == "1" '>
|
|
|
|
|
>= #{pushDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test=' pushType == "2" '>
|
|
|
|
|
= #{pushDate}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY att_current_day, org_id
|
2025-01-07 01:47:43 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="selectAttMonthReport" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
2025-02-12 09:36:00 +08:00
|
|
|
select g.org_id,
|
2025-01-07 01:47:43 +08:00
|
|
|
v.user_id,
|
|
|
|
|
su.user_name,
|
|
|
|
|
so.org_name,
|
|
|
|
|
g.group_id,
|
|
|
|
|
DATE_FORMAT(att_current_day, '%Y-%m') as attCurrentMonth,
|
2025-01-10 23:18:13 +08:00
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 1, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 1, 0.5, 0 )), 0 ) AS normalNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 2, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 2, 0.5, 0 )), 0 ) AS lateNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 3, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 3, 0.5, 0 )), 0 ) AS skippingNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 4, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 4, 0.5, 0 )), 0 ) AS earlyNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 5, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 5, 0.5, 0 )), 0 ) AS restNum,
|
|
|
|
|
sum(
|
|
|
|
|
IF
|
|
|
|
|
( toWorkAttStatus IN ( SELECT dict_value FROM sys_dict_data WHERE dict_type = 'att_status' AND is_leave = '1' ), 0.5, 0 ))+ sum(
|
|
|
|
|
IF
|
|
|
|
|
( offWorkAttStatus IN ( SELECT dict_value FROM sys_dict_data WHERE dict_type = 'att_status' AND is_leave = '1' ), 0.5, 0 )) AS leaveNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 7, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 7, 0.5, 0 )), 0 ) AS outNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 8, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 8, 0.5, 0 )), 0 ) AS einErrorNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 9, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 9, 0.5, 0 )), 0 ) AS addressErrorNum,
|
|
|
|
|
IFNULL( sum( IF ( toWorkAttStatus = 10, 0.5, 0 )), 0 ) + IFNULL( sum( IF ( offWorkAttStatus = 10, 0.5, 0 )), 0 ) AS businessTripNum
|
2025-01-03 14:12:06 +08:00
|
|
|
from v_att_update_data v
|
2025-01-07 01:47:43 +08:00
|
|
|
left join sys_user su on su.user_id = v.user_id
|
2025-01-20 13:41:32 +08:00
|
|
|
left join att_setting_history g
|
2025-02-12 09:36:00 +08:00
|
|
|
on g.user_id = v.user_id and g.current_day = #{attRuleDate}
|
|
|
|
|
left join sys_organization so on so.id = g.org_id
|
2025-01-03 14:12:06 +08:00
|
|
|
where DATE_FORMAT(att_current_day, '%Y-%m') = DATE_FORMAT(#{pushDate}, '%Y-%m')
|
2025-01-07 01:47:43 +08:00
|
|
|
and g.group_id is not null
|
2025-01-10 23:18:13 +08:00
|
|
|
GROUP BY DATE_FORMAT(att_current_day, '%Y-%m'), v.user_id
|
2025-01-03 14:12:06 +08:00
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="selectHolidayByMonth" resultType="com.bonus.system.att.entity.Holiday">
|
|
|
|
|
select *
|
|
|
|
|
from sys_holiday
|
2025-01-07 01:47:43 +08:00
|
|
|
where
|
|
|
|
|
DATE_FORMAT(`date`, '%Y-%m') = DATE_FORMAT(#{pushDate}, '%Y-%m')
|
2025-01-03 14:12:06 +08:00
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getPersonLeaveApplyStatus" resultType="java.lang.Integer">
|
|
|
|
|
select DISTINCT sdd.dict_value
|
|
|
|
|
from leave_apply la
|
|
|
|
|
left join sys_dict_data sdd on sdd.dict_label = la.leave_type
|
|
|
|
|
where user_id = #{userId}
|
|
|
|
|
and org_id = #{orgId}
|
|
|
|
|
and CONCAT(#{attCurrentDay}, '|', #{attType})
|
|
|
|
|
BETWEEN CONCAT(leave_start_date, '|', leave_start_interval)
|
|
|
|
|
AND CONCAT(leave_end_date, '|', leave_end_interval)
|
|
|
|
|
AND examine_status = 1
|
|
|
|
|
GROUP BY la.user_id
|
|
|
|
|
ORDER BY la.create_time DESC
|
|
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getSourceAttData" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
|
|
|
|
select asd.*,
|
|
|
|
|
su.user_id,
|
|
|
|
|
ag.org_id as orgId,
|
2025-01-20 13:41:32 +08:00
|
|
|
ag.group_id as groupId,
|
2025-01-03 14:12:06 +08:00
|
|
|
g.att_type as groupType
|
|
|
|
|
from att_source_data asd
|
|
|
|
|
left join sys_user su on su.id_number = asd.id_number
|
2025-01-20 13:41:32 +08:00
|
|
|
left join att_setting_history ag on ag.user_id = su.user_id and ag.current_day = #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
left join att_group g on g.id = ag.group_id
|
|
|
|
|
where att_current_day
|
|
|
|
|
<if test=' pushType == "1" '>
|
2025-01-10 23:18:13 +08:00
|
|
|
>= #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
</if>
|
|
|
|
|
<if test=' pushType == "2" '>
|
|
|
|
|
= #{pushDate}
|
|
|
|
|
</if>
|
|
|
|
|
and g.id is not null and asd.data_source = 1
|
|
|
|
|
union
|
|
|
|
|
select asd.*,
|
|
|
|
|
su.user_id,
|
|
|
|
|
ag.org_id as orgId,
|
2025-01-20 13:41:32 +08:00
|
|
|
ag.group_id as groupId,
|
2025-01-03 14:12:06 +08:00
|
|
|
g.att_type as groupType
|
|
|
|
|
from att_source_data asd
|
|
|
|
|
left join sys_user su on su.user_name = asd.name
|
2025-01-20 13:41:32 +08:00
|
|
|
left join att_setting_history ag on ag.user_id = su.user_id and ag.current_day = #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
left join att_group g on g.id = ag.group_id
|
|
|
|
|
where att_current_day
|
|
|
|
|
<if test=' pushType == "1" '>
|
2025-01-10 23:18:13 +08:00
|
|
|
>= #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
</if>
|
|
|
|
|
<if test=' pushType == "2" '>
|
|
|
|
|
= #{pushDate}
|
|
|
|
|
</if>
|
|
|
|
|
and g.id is not null
|
|
|
|
|
and asd.data_source in (2,3)
|
|
|
|
|
and (asd.att_type = 1
|
|
|
|
|
or asd.att_type = 2);
|
|
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="selectAttIsExist" resultType="java.lang.Boolean">
|
|
|
|
|
SELECT count(0)
|
|
|
|
|
FROM att_data
|
|
|
|
|
WHERE user_id = #{userId}
|
|
|
|
|
and att_type = #{attType}
|
|
|
|
|
and att_current_day = #{attCurrentDay}
|
|
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="selectAttUpdateIsExist" resultType="java.lang.Boolean">
|
|
|
|
|
SELECT count(0)
|
|
|
|
|
FROM att_data_update
|
|
|
|
|
WHERE user_id = #{userId}
|
|
|
|
|
and att_type = #{attType}
|
|
|
|
|
and att_current_day = #{attCurrentDay}
|
|
|
|
|
</select>
|
2024-12-17 16:47:06 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getMachineAttendances" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
|
|
|
|
select *
|
|
|
|
|
from (select u.name,
|
|
|
|
|
'0' as idNumber,
|
|
|
|
|
'0' as orgId,
|
|
|
|
|
'0' as orgName,
|
|
|
|
|
DATE_FORMAT(c.checktime, '%Y-%m-%d') as attCurrentDay,
|
|
|
|
|
DATE_FORMAT(c.checktime, '%Y-%m-%d %H:%i:%s') as attCurrentTime,
|
|
|
|
|
if(i.alias like '%进%', 1, (if(i.alias like '%出%', 2, 0))) as attType,
|
|
|
|
|
i.alias as attAddress,
|
|
|
|
|
'0' as attLon,
|
|
|
|
|
'0' as attLat,
|
|
|
|
|
'2' as dataSource
|
|
|
|
|
from zkeco.checkinout c
|
|
|
|
|
left join zkeco.iclock i on i.sn = c.sn
|
|
|
|
|
left join zkeco.userinfo u on u.userid = c.userid
|
2025-01-07 01:47:43 +08:00
|
|
|
where
|
2025-01-03 14:12:06 +08:00
|
|
|
<if test=' pushType == "1" '>
|
2025-01-10 23:18:13 +08:00
|
|
|
DATE_FORMAT(c.checktime, '%Y-%m-%d') >= #{pushDate}
|
2025-01-03 14:12:06 +08:00
|
|
|
</if>
|
|
|
|
|
<if test=' pushType == "2" '>
|
2025-01-07 01:47:43 +08:00
|
|
|
DATE_FORMAT(c.checktime, '%Y-%m-%d %H:%i:%s') BETWEEN concat(#{pushDate},' 00:00:00') AND DATE_ADD(DATE_ADD(concat(#{pushDate},' 00:00:00'), INTERVAL 1 DAY), INTERVAL 5 HOUR) - INTERVAL 1 SECOND
|
2025-01-03 14:12:06 +08:00
|
|
|
</if>
|
|
|
|
|
and u.name != '') a
|
|
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getLeaveData" resultType="com.bonus.system.att.entity.LeaveBean">
|
2025-01-10 23:18:13 +08:00
|
|
|
SELECT
|
|
|
|
|
agpr.org_id,
|
|
|
|
|
ag.att_type,
|
|
|
|
|
la.*,
|
|
|
|
|
sdd.dict_value AS attStatus
|
|
|
|
|
FROM
|
|
|
|
|
leave_apply la
|
|
|
|
|
LEFT JOIN sys_dict_data sdd ON sdd.dict_label =
|
|
|
|
|
IF
|
|
|
|
|
( la.leave_type IS NOT NULL, la.leave_type, la.type )
|
|
|
|
|
AND sdd.dict_type = 'att_status'
|
|
|
|
|
LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id
|
|
|
|
|
LEFT JOIN att_group ag ON ag.id = agpr.group_id
|
|
|
|
|
AND ag.is_active = '1'
|
|
|
|
|
WHERE
|
|
|
|
|
la.is_active = 1
|
2025-01-03 14:12:06 +08:00
|
|
|
AND la.examine_status = 1
|
|
|
|
|
AND sdd.dict_value IS NOT NULL
|
|
|
|
|
AND agpr.is_active = 1
|
2025-01-10 23:18:13 +08:00
|
|
|
ORDER BY
|
|
|
|
|
leave_start_date DESC
|
2025-01-03 14:12:06 +08:00
|
|
|
</select>
|
2024-12-02 11:13:48 +08:00
|
|
|
|
2025-01-03 14:12:06 +08:00
|
|
|
<select id="getLeaveDataByUserId" resultType="java.lang.Integer">
|
|
|
|
|
SELECT count(1)
|
|
|
|
|
FROM leave_apply la
|
|
|
|
|
WHERE la.is_active = 1
|
|
|
|
|
AND la.examine_status = 1
|
|
|
|
|
AND user_id = #{userId}
|
|
|
|
|
AND #{attCurrentDay} BETWEEN leave_start_date and leave_end_date
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getFirstAttendanceData" resultType="java.lang.Integer">
|
|
|
|
|
select count(0)
|
|
|
|
|
from att_data
|
|
|
|
|
where att_current_day = #{date}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|