学校考勤统计小计
This commit is contained in:
@ -283,6 +283,112 @@
|
||||
where d.isdel='0'
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
union all
|
||||
select '','','小计',0,
|
||||
round(avg(day1),4),round(avg(day2),4),round(avg(day3),4),round(avg(day4),4),round(avg(day5),4),round(avg(day6),4),round(avg(day7),4),round(avg(day8),4),round(avg(day9),4),round(avg(day10),4),
|
||||
round(avg(day11),4),round(avg(day12),4),round(avg(day13),4),round(avg(day14),4),round(avg(day15),4),round(avg(day16),4),round(avg(day17),4),round(avg(day18),4),round(avg(day19),4),round(avg(day20),4),
|
||||
round(avg(day21),4),round(avg(day22),4),round(avg(day23),4),round(avg(day24),4),round(avg(day25),4),round(avg(day26),4),round(avg(day27),4),round(avg(day28),4),round(avg(day29),4),round(avg(day30),4),round(avg(day31),4)
|
||||
from (
|
||||
select d.bjbh,d.dept_id,d.bjmc,
|
||||
(select count(*) from by_child where classid=d.bjbh) as childcount,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-01') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day1,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-02') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day2,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-03') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day3,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-04') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day4,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-05') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day5,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-06') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day6,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-07') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day7,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-08') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day8,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-09') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day9,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-10') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day10,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-11') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day11,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-12') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day12,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-13') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day13,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-14') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day14,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-15') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day15,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-16') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day16,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-17') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day17,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-18') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day18,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-19') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day19,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-20') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day20,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-21') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day21,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-22') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day22,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-23') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day23,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-24') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day24,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-25') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day25,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-26') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day26,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-27') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day27,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-28') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day28,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-29') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day29,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-30') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day30,
|
||||
((select count(*) from by_child_checkin_detail where classid=d.bjbh and
|
||||
date_format(create_time,'%Y-%m-%d')=concat(#{month},'-31') and type='01')/(select count(*) from by_child where
|
||||
classid=d.bjbh)) as day31
|
||||
from by_class d
|
||||
where d.isdel='0'
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
) tmp
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user