|
@@ -138,25 +138,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
)t1
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
- select submit_org_nm,work_princip_nm,work_princip_id,sum(violation) violation from (
|
|
|
- select uuid,submit_org_nm,work_princip_nm,work_princip_id,max(violation) violation from (
|
|
|
- select uuid,t3.submit_org_nm,work_princip_nm,t3.work_princip_id,
|
|
|
- case when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd = '2020001' then 4
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 12
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd = '2020001' then 2
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 6
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd = '2020001' then 1
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 3
|
|
|
- else 0
|
|
|
- end as violation
|
|
|
- from ads_cst_hygszdbb_pdmviolationrecords_df t1,ads_cst_hygszdbb_pdminspectionrecords_df t2,ads_cst_hygszdbb_pdmworkplan_df t3
|
|
|
- where t1.audit_rec_id = t2.audit_rec_id and t1.day_op_info_id = t3.uuid
|
|
|
- and work_team_nm not like '%公司'
|
|
|
- and date_format(plan_start_wk_tm,'%Y%m%d') >= #{startDate}
|
|
|
- and date_format(plan_start_wk_tm,'%Y%m%d') <= #{endDate}
|
|
|
- and plan_exec_st_cd !='2029005'
|
|
|
- ) a GROUP BY uuid,submit_org_nm,work_princip_nm,work_princip_id
|
|
|
- ) aa GROUP BY submit_org_nm,work_princip_nm,work_princip_id
|
|
|
+ select op_org submit_org_nm,work_princip work_princip_nm,work_princip_id,sum(violation) violation from (
|
|
|
+ select audit_rec_id,op_org,work_princip ,work_princip_id,max(violation) violation from (
|
|
|
+ select t2.audit_rec_id,t2.op_org,work_princip,work_princip_id,
|
|
|
+ case when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd = '2020001' then 4
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 12
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd = '2020001' then 2
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 6
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd = '2020001' then 1
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 3
|
|
|
+ else 0
|
|
|
+ end as violation
|
|
|
+ from ads_cst_hygszdbb_pdmviolationrecords_df t1,ads_cst_hygszdbb_pdminspectionrecords_df t2
|
|
|
+ where t1.audit_rec_id = t2.audit_rec_id
|
|
|
+ and op_team not like '%公司'
|
|
|
+ and date_format(op_plan_start_tm,'%Y%m%d') >= #{startDate}
|
|
|
+ and date_format(op_plan_start_tm,'%Y%m%d') <= #{endDate}
|
|
|
+ ) a GROUP BY audit_rec_id,op_org,work_princip,work_princip_id
|
|
|
+ ) aa GROUP BY op_org,work_princip,work_princip_id
|
|
|
)t2 on t1.submit_org_nm = t2.submit_org_nm and t1.work_princip_nm = t2.work_princip_nm and t1.work_princip_id = t2.work_princip_id
|
|
|
LEFT JOIN
|
|
|
(
|
|
@@ -200,25 +199,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
)t1
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
- select work_team_nm,work_princip_nm,work_princip_id,sum(violation) violation from (
|
|
|
- select uuid,work_team_nm,work_princip_nm,work_princip_id,max(violation) violation from (
|
|
|
- select uuid,t3.work_team_nm,work_princip_nm,t3.work_princip_id,
|
|
|
- case when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd = '2020001' then 4
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 12
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd = '2020001' then 2
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 6
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd = '2020001' then 1
|
|
|
- when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 3
|
|
|
- else 0
|
|
|
- end as violation
|
|
|
- from ads_cst_hygszdbb_pdmviolationrecords_df t1,ads_cst_hygszdbb_pdminspectionrecords_df t2,ads_cst_hygszdbb_pdmworkplan_df t3
|
|
|
- where t1.audit_rec_id = t2.audit_rec_id and t1.day_op_info_id = t3.uuid
|
|
|
- and date_format(plan_start_wk_tm,'%Y%m%d') >= #{startDate}
|
|
|
- and date_format(plan_start_wk_tm,'%Y%m%d') <= #{endDate}
|
|
|
- and plan_exec_st_cd !='2029005'
|
|
|
- and work_team_nm like '%公司' and work_team_nm not like '%雁能%'
|
|
|
- ) a GROUP BY uuid,work_team_nm,work_princip_nm,work_princip_id
|
|
|
- ) aa GROUP BY work_team_nm,work_princip_nm,work_princip_id
|
|
|
+ select op_team work_team_nm, work_princip work_princip_nm,work_princip_id,sum(violation) violation from (
|
|
|
+ select audit_rec_id,op_team,work_princip ,work_princip_id,max(violation) violation from (
|
|
|
+ select t2.audit_rec_id,op_team,work_princip ,work_princip_id,
|
|
|
+ case when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd = '2020001' then 4
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025001' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 12
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd = '2020001' then 2
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025002' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 6
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd = '2020001' then 1
|
|
|
+ when t2.scene_rating_cd = '2018004' and audit_lvl_cd ='2025003' and break_rules_nature_cd in ('2020002','2020003','2020004','2020005','2020006') then 3
|
|
|
+ else 0
|
|
|
+ end as violation
|
|
|
+ from ads_cst_hygszdbb_pdmviolationrecords_df t1,ads_cst_hygszdbb_pdminspectionrecords_df t2
|
|
|
+ where t1.audit_rec_id = t2.audit_rec_id
|
|
|
+ and date_format(op_plan_start_tm,'%Y%m%d') >= #{startDate}
|
|
|
+ and date_format(op_plan_start_tm,'%Y%m%d') <= #{endDate}
|
|
|
+ and op_team like '%公司' and op_team not like '%雁能%'
|
|
|
+ ) a GROUP BY audit_rec_id,op_team,work_princip ,work_princip_id
|
|
|
+ ) aa GROUP BY op_team,work_princip ,work_princip_id
|
|
|
)t2 on t1.work_team_nm = t2.work_team_nm and t1.work_princip_nm = t2.work_princip_nm and t1.work_princip_id = t2.work_princip_id
|
|
|
LEFT JOIN
|
|
|
(
|