历史考勤推送问题
This commit is contained in:
parent
7257eb68da
commit
827d195ef3
|
|
@ -105,251 +105,252 @@
|
|||
</if>
|
||||
</update>
|
||||
|
||||
<!-- delete from att_source_data where att_current_day = #{date};-->
|
||||
<!-- 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 from att_source_data where att_current_day = #{date};-->
|
||||
<!-- delete from att_data where att_current_day = #{date};-->
|
||||
<!-- delete from att_data_update where att_current_day = #{date};-->
|
||||
|
||||
<delete id="delHisData">
|
||||
delete from att_source_data where att_current_day = #{date};
|
||||
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 from att_data where att_current_day = #{date};
|
||||
delete from att_data_update where att_current_day = #{date};
|
||||
</delete>
|
||||
|
||||
<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
|
||||
from gz_cloud.fc_sup_attendance sup
|
||||
where sup.attendance_date
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
and is_wechat != 1
|
||||
</select>
|
||||
<!-- <delete id="delHisData">-->
|
||||
<!-- delete from att_source_data where att_current_day = #{date};-->
|
||||
<!-- 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>-->
|
||||
|
||||
<select id="getAllPerson" resultType="com.bonus.system.att.entity.AttDataBean">
|
||||
select su.user_id, agpr.org_id, g.id as groupId, '1' as attType, '0' as attStatus
|
||||
from sys_user su
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
left join att_group g on g.id = agpr.group_id
|
||||
where su.is_active = 1
|
||||
and agpr.org_id is not null
|
||||
union
|
||||
select su.user_id, agpr.org_id, g.id as groupId, '2' as attType, '0' as attStatus
|
||||
from sys_user su
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
left join att_group g on g.id = agpr.group_id
|
||||
where su.is_active = 1
|
||||
and agpr.org_id is not null
|
||||
</select>
|
||||
|
||||
<select id="selectAttDayReport" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
||||
select att_current_day,
|
||||
org_id,
|
||||
IFNULL(sum(toWorkAttStatus = 1 and offWorkAttStatus = 1), 0) as normalNum,
|
||||
IFNULL(sum(toWorkAttStatus = 2 or offWorkAttStatus = 2), 0) as lateNum,
|
||||
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 (12, 13, 14, 15, 16, 17, 18) or
|
||||
offWorkAttStatus in (12, 13, 14, 15, 16, 17, 18)), 0) as leaveNum,
|
||||
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
|
||||
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
|
||||
</select>
|
||||
|
||||
<select id="selectAttMonthReport" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
||||
select v.org_id,
|
||||
v.user_id,
|
||||
su.user_name,
|
||||
so.org_name,
|
||||
g.group_id,
|
||||
DATE_FORMAT(att_current_day, '%Y-%m') as attCurrentMonth,
|
||||
IFNULL(sum(toWorkAttStatus = 1 and offWorkAttStatus = 1), 0) as normalNum,
|
||||
IFNULL(sum(toWorkAttStatus = 2 or offWorkAttStatus = 2), 0) as lateNum,
|
||||
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 (12, 13, 14, 15, 16, 17, 18) or
|
||||
offWorkAttStatus in (12, 13, 14, 15, 16, 17, 18)), 0) as leaveNum,
|
||||
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
|
||||
from v_att_update_data v
|
||||
left join sys_user su on su.user_id = v.user_id
|
||||
left join sys_organization so on so.id = v.org_id
|
||||
left join att_group_person_relation g
|
||||
on g.user_id = v.user_id and g.org_id = v.org_id and g.is_active = 1
|
||||
where DATE_FORMAT(att_current_day, '%Y-%m') = DATE_FORMAT(#{pushDate}, '%Y-%m')
|
||||
and g.group_id is not null
|
||||
GROUP BY DATE_FORMAT(att_current_day, '%Y-%m'), v.org_id, v.user_id;
|
||||
</select>
|
||||
|
||||
<select id="selectHolidayByMonth" resultType="com.bonus.system.att.entity.Holiday">
|
||||
select *
|
||||
from sys_holiday
|
||||
where `date`
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="getSourceAttData" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
||||
select asd.*,
|
||||
su.user_id,
|
||||
ag.org_id as orgId,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.id_number = asd.id_number
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</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,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.user_name = asd.name
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</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>
|
||||
|
||||
<select id="selectAttIsExist" resultType="java.lang.Boolean">
|
||||
SELECT count(0)
|
||||
FROM att_data
|
||||
WHERE user_id = #{userId}
|
||||
and org_id = #{orgId}
|
||||
and att_type = #{attType}
|
||||
and att_current_day = #{attCurrentDay}
|
||||
</select>
|
||||
|
||||
<select id="selectAttUpdateIsExist" resultType="java.lang.Boolean">
|
||||
SELECT count(0)
|
||||
FROM att_data_update
|
||||
WHERE user_id = #{userId}
|
||||
and org_id = #{orgId}
|
||||
and att_type = #{attType}
|
||||
and att_current_day = #{attCurrentDay}
|
||||
</select>
|
||||
|
||||
<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
|
||||
where DATE_FORMAT(c.checktime, '%Y-%m-%d')
|
||||
<if test=' pushType == "1" '>
|
||||
<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
|
||||
from gz_cloud.fc_sup_attendance sup
|
||||
where sup.attendance_date
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
and u.name != '') a
|
||||
</select>
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
and is_wechat != 1
|
||||
</select>
|
||||
|
||||
<select id="getLeaveData" resultType="com.bonus.system.att.entity.LeaveBean">
|
||||
SELECT la.*,
|
||||
sdd.dict_value AS attStatus
|
||||
FROM leave_apply la
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = if(la.type is not null,la.type,la.leave_type)
|
||||
AND sdd.dict_type = 'att_status'
|
||||
LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id
|
||||
WHERE la.is_active = 1
|
||||
AND la.examine_status = 1
|
||||
AND sdd.dict_value IS NOT NULL
|
||||
AND agpr.is_active = 1
|
||||
ORDER BY leave_start_date DESC
|
||||
</select>
|
||||
<select id="getAllPerson" resultType="com.bonus.system.att.entity.AttDataBean">
|
||||
select su.user_id, agpr.org_id, g.id as groupId, '1' as attType, '0' as attStatus
|
||||
from sys_user su
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
left join att_group g on g.id = agpr.group_id
|
||||
where su.is_active = 1
|
||||
and agpr.org_id is not null
|
||||
union
|
||||
select su.user_id, agpr.org_id, g.id as groupId, '2' as attType, '0' as attStatus
|
||||
from sys_user su
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
left join att_group g on g.id = agpr.group_id
|
||||
where su.is_active = 1
|
||||
and agpr.org_id is not null
|
||||
</select>
|
||||
|
||||
<select id="getSourceAttNoInOutData" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
||||
select asd.*,
|
||||
su.user_id,
|
||||
ag.org_id as orgId,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.user_name = asd.name
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day >= CURDATE()
|
||||
and g.id is not null
|
||||
and asd.data_source = 2
|
||||
and asd.att_type = 0
|
||||
</select>
|
||||
<select id="selectAttDayReport" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
||||
select att_current_day,
|
||||
org_id,
|
||||
IFNULL(sum(toWorkAttStatus = 1 and offWorkAttStatus = 1), 0) as normalNum,
|
||||
IFNULL(sum(toWorkAttStatus = 2 or offWorkAttStatus = 2), 0) as lateNum,
|
||||
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 (12, 13, 14, 15, 16, 17, 18) or
|
||||
offWorkAttStatus in (12, 13, 14, 15, 16, 17, 18)), 0) as leaveNum,
|
||||
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
|
||||
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
|
||||
</select>
|
||||
|
||||
<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>
|
||||
</mapper>
|
||||
<select id="selectAttMonthReport" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
||||
select v.org_id,
|
||||
v.user_id,
|
||||
su.user_name,
|
||||
so.org_name,
|
||||
g.group_id,
|
||||
DATE_FORMAT(att_current_day, '%Y-%m') as attCurrentMonth,
|
||||
IFNULL(sum(toWorkAttStatus = 1 and offWorkAttStatus = 1), 0) as normalNum,
|
||||
IFNULL(sum(toWorkAttStatus = 2 or offWorkAttStatus = 2), 0) as lateNum,
|
||||
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 (12, 13, 14, 15, 16, 17, 18) or
|
||||
offWorkAttStatus in (12, 13, 14, 15, 16, 17, 18)), 0) as leaveNum,
|
||||
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
|
||||
from v_att_update_data v
|
||||
left join sys_user su on su.user_id = v.user_id
|
||||
left join sys_organization so on so.id = v.org_id
|
||||
left join att_group_person_relation g
|
||||
on g.user_id = v.user_id and g.org_id = v.org_id and g.is_active = 1
|
||||
where DATE_FORMAT(att_current_day, '%Y-%m') = DATE_FORMAT(#{pushDate}, '%Y-%m')
|
||||
and g.group_id is not null
|
||||
GROUP BY DATE_FORMAT(att_current_day, '%Y-%m'), v.org_id, v.user_id;
|
||||
</select>
|
||||
|
||||
<select id="selectHolidayByMonth" resultType="com.bonus.system.att.entity.Holiday">
|
||||
select *
|
||||
from sys_holiday
|
||||
where `date`
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="getSourceAttData" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
||||
select asd.*,
|
||||
su.user_id,
|
||||
ag.org_id as orgId,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.id_number = asd.id_number
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</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,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.user_name = asd.name
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</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>
|
||||
|
||||
<select id="selectAttIsExist" resultType="java.lang.Boolean">
|
||||
SELECT count(0)
|
||||
FROM att_data
|
||||
WHERE user_id = #{userId}
|
||||
and org_id = #{orgId}
|
||||
and att_type = #{attType}
|
||||
and att_current_day = #{attCurrentDay}
|
||||
</select>
|
||||
|
||||
<select id="selectAttUpdateIsExist" resultType="java.lang.Boolean">
|
||||
SELECT count(0)
|
||||
FROM att_data_update
|
||||
WHERE user_id = #{userId}
|
||||
and org_id = #{orgId}
|
||||
and att_type = #{attType}
|
||||
and att_current_day = #{attCurrentDay}
|
||||
</select>
|
||||
|
||||
<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
|
||||
where DATE_FORMAT(c.checktime, '%Y-%m-%d')
|
||||
<if test=' pushType == "1" '>
|
||||
>= #{pushDate}
|
||||
</if>
|
||||
<if test=' pushType == "2" '>
|
||||
= #{pushDate}
|
||||
</if>
|
||||
and u.name != '') a
|
||||
</select>
|
||||
|
||||
<select id="getLeaveData" resultType="com.bonus.system.att.entity.LeaveBean">
|
||||
SELECT la.*,
|
||||
sdd.dict_value AS attStatus
|
||||
FROM leave_apply la
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = if(la.type is not null,la.type,la.leave_type)
|
||||
AND sdd.dict_type = 'att_status'
|
||||
LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id
|
||||
WHERE la.is_active = 1
|
||||
AND la.examine_status = 1
|
||||
AND sdd.dict_value IS NOT NULL
|
||||
AND agpr.is_active = 1
|
||||
ORDER BY leave_start_date DESC
|
||||
</select>
|
||||
|
||||
<select id="getSourceAttNoInOutData" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
||||
select asd.*,
|
||||
su.user_id,
|
||||
ag.org_id as orgId,
|
||||
g.id as groupId,
|
||||
g.att_type as groupType
|
||||
from att_source_data asd
|
||||
left join sys_user su on su.user_name = asd.name
|
||||
left join att_group_person_relation ag on ag.user_id = su.user_id and ag.is_active = 1
|
||||
left join att_group g on g.id = ag.group_id
|
||||
where att_current_day >= CURDATE()
|
||||
and g.id is not null
|
||||
and asd.data_source = 2
|
||||
and asd.att_type = 0
|
||||
</select>
|
||||
|
||||
<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>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue