IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
'' address,
'' address,
...
@@ -336,6 +336,183 @@
...
@@ -336,6 +336,183 @@
) as mrtj on mrtj.user_id = sum.num
) as mrtj on mrtj.user_id = sum.num
where sum.org_code = #{param.orgCode}
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month} -->
select sum.`name`,
sum.num,
sum.dept,sum.post,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
IFNULL((select kqz.id from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attid,
(CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END) as bcszid,
IFNULL((select bc.name from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcname,
IFNULL((select bc.sbdk1 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcsbdk1,
IFNULL((select bc.xbdk1 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcxbdk1,
IFNULL((select bc.sbdk2 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcsbdk2,
IFNULL((select bc.xbdk2 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcxbdk2,
IFNULL((select bc.sbdk3 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcsbdk3,
IFNULL((select bc.xbdk3 from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as bcxbdk3,
IFNULL((select (bc.sxbcs * 2) from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = '2020-06-16' and pb.kqzid = sum.att_group) ELSE '' END))),'') as ydkcs,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.attdate, '') attdate,
IFNULL(rtj.userid,'') userid,
IFNULL(rtj.data,'') data,
IFNULL(rtj.sbdk1,'') sbdk1,
IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,
IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,
IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,
IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,
IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,
IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.gzsc ,'') gzsc,
IFNULL(rtj.qyid,'') qyid,
IFNULL(rtj.dksj ,'') dksj,
IFNULL(rtj.yzcdcs ,'') yzcdcs,
IFNULL(rtj.yzcdsc ,'') yzcdsc,
IFNULL(rtj.kgcdfzs,'') kgcdfzs,
sum.days_on_duty as daysonduty,
sum.days_off as daysoff,
sum.length_business_trip as lengthbusinesstrip,
sum.time_out as timeout,
sum.total_overtime_hours as totalovertimehours,
sum.working_turn_compen_leave as workingturncompenleave,
sum.rest_turn_compen_leave as restturncompenleave,
sum.holiday_turn_compen_leave as holidayturncompenleave,
sum.working_transfer_overtime as workingtransferovertime,
sum.rest_transfer_overtime as resttransferovertime,
sum.holiday_transfer_overtime as holidaytransferovertime,
IFNULL(mrtj.leaverulesid,'') as leaverulesid,
IFNULL(mrtj.duration,'') as balancedays
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
dkjl.attdate,bcsz.id as bcszid,
bcsz.`name` as bcname,bcsz.sbdk1 as bcsbdk1,bcsz.xbdk1 as bcxbdk1,bcsz.sbdk2 as bcsbdk2,bcsz.xbdk2 as bcxbdk2,bcsz.sbdk3 as bcsbdk3,bcsz.xbdk3 as bcxbdk3,