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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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
THEN (IFNULL((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 DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
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 ydkcs,