每月/日出勤/在职人数统计优化
This commit is contained in:
parent
d47a774e18
commit
2cb471c2a4
@ -136,7 +136,23 @@
|
||||
</if>
|
||||
,count(*) as total_in_service_num
|
||||
,ifnull(sum(t.is_attendance),0) as total_attendance_num
|
||||
from worker_daily_attendance_statistics_v2 t
|
||||
from (
|
||||
select * from
|
||||
worker_daily_attendance_statistics_v2 t
|
||||
where 1=1
|
||||
<if test="startMonth != null and startMonth != ''">
|
||||
and t.attendance_date <![CDATA[>=]]> concat(#{startMonth},'-01 00:00:00')
|
||||
</if>
|
||||
<if test="endMonth != null and endMonth != ''">
|
||||
and t.attendance_date <![CDATA[<=]]> CONCAT(LAST_DAY(CONCAT(#{endMonth}, '-01')), ' 23:59:59')
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
and t.attendance_date >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
and t.attendance_date <![CDATA[<=]]> concat(#{endDate},' 23:59:59')
|
||||
</if>
|
||||
) t
|
||||
JOIN worker_info a on t.person_sn=a.person_sn
|
||||
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||
@ -156,18 +172,6 @@
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and a.department_id=#{departmentId}
|
||||
</if>
|
||||
<if test="startMonth != null and startMonth != ''">
|
||||
and t.attendance_date <![CDATA[>=]]> concat(#{startMonth},'-01 00:00:00')
|
||||
</if>
|
||||
<if test="endMonth != null and endMonth != ''">
|
||||
and t.attendance_date <![CDATA[<=]]> CONCAT(LAST_DAY(CONCAT(#{endMonth}, '-01')), ' 23:59:59')
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
and t.attendance_date >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
and t.attendance_date <![CDATA[<=]]> concat(#{endDate},' 23:59:59')
|
||||
</if>
|
||||
group by x_name
|
||||
)t
|
||||
</select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user