考核表模块SQL重新写
This commit is contained in:
parent
834a3f9314
commit
7f2fdd3c85
|
|
@ -635,8 +635,8 @@
|
|||
LEFT JOIN bm_project bp ON bp.id = a.project_id
|
||||
WHERE
|
||||
ein_time <= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
|
||||
AND exit_time IS NULL
|
||||
AND exit_status = - 1
|
||||
and is_furlough_person = '0'
|
||||
and exit_status != '1'
|
||||
<if test="subComId != null and subComId != '' ">
|
||||
AND bp.project_general_id = #{subComId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
LEFT JOIN bm_project bp ON bp.two_com_id = pm.id and bp.is_active = '1' and bp.pro_status = 0
|
||||
LEFT JOIN bm_sub_contract bsc ON bsc.pro_id = bp.id and bsc.is_active = '1'
|
||||
LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr on bsr.sub_contract_id = bsc.id and bsr.type = '3' and bsr.is_active = '1'
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bsr.`value` and btur.is_active = '1'
|
||||
LEFT JOIN bm_sub_team bst on bs.id = bst.sub_id and bst.is_active = 1
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.`id` and btur.is_active = '1'
|
||||
LEFT JOIN (select id_number,project_id FROM bm_worker_ein_history WHERE is_active = '1' and is_furlough_person = '0' and exit_status != '1' GROUP BY id_number)bweh ON bweh.project_id = bp.ID
|
||||
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bweh.ID_NUMBER and bw.is_active = '1' and bw.ein_status = 1
|
||||
GROUP BY
|
||||
|
|
@ -61,8 +61,8 @@
|
|||
LEFT JOIN bm_project bp ON bp.two_com_id = pm.id and bp.is_active = '1' and bp.pro_status = 0
|
||||
LEFT JOIN bm_sub_contract bsc ON bsc.pro_id = bp.id and bsc.is_active = '1'
|
||||
LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr on bsr.sub_contract_id = bsc.id and bsr.type = '3' and bsr.is_active = '1'
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bsr.`value` and btur.is_active = '1'
|
||||
LEFT JOIN bm_sub_team bst on bs.id = bst.sub_id and bst.is_active = 1
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.`id` and btur.is_active = '1'
|
||||
LEFT JOIN (select id_number,project_id FROM bm_worker_ein_history WHERE is_active = '1' and is_furlough_person = '0' and exit_status != '1' GROUP BY id_number)bweh ON bweh.project_id = bp.ID
|
||||
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bweh.ID_NUMBER and bw.is_active = '1' and bw.ein_status = 1
|
||||
GROUP BY
|
||||
|
|
@ -191,10 +191,7 @@
|
|||
AND bsc.is_active = '1'
|
||||
LEFT JOIN bm_subcontractor bs ON bs.id = bsc.sub_id
|
||||
AND bs.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id
|
||||
AND bsr.type = '3'
|
||||
AND bsr.is_active = '1'
|
||||
LEFT JOIN bm_sub_team bst ON bsr.v = bst.id
|
||||
LEFT JOIN bm_sub_team bst ON bs.id = bst.sub_id
|
||||
AND bst.is_active = '1'
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id
|
||||
AND btur.is_active = '1'
|
||||
|
|
@ -286,10 +283,8 @@
|
|||
AND bsc.is_active = '1'
|
||||
LEFT JOIN bm_subcontractor bs ON bs.id = bsc.sub_id
|
||||
AND bs.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id
|
||||
AND bsr.type = '3'
|
||||
AND bsr.is_active = '1'
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bsr.`value`
|
||||
left join bm_sub_team bst on bst.sub_id = bs.id and bst.is_active = 1
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id
|
||||
AND btur.is_active = '1'
|
||||
LEFT JOIN ( SELECT * FROM bm_worker_ein_history WHERE is_active = '1' AND is_furlough_person = '0' AND
|
||||
exit_status != '1' GROUP BY id_number ) bweh ON bweh.ID_NUMBER = btur.id_number
|
||||
|
|
@ -334,14 +329,12 @@
|
|||
</if>
|
||||
LEFT JOIN bm_sub_contract bsc ON bsc.pro_id = bp.id
|
||||
AND bsc.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id
|
||||
AND bsr.type = '3'
|
||||
AND bsr.is_active = '1'
|
||||
LEFT JOIN bm_sub_team bst on bsc.sub_id = bst.sub_id and bst.is_active = 1
|
||||
LEFT JOIN ( SELECT id_number, project_id, sub_id, team_id FROM bm_worker_ein_history WHERE is_active = '1' AND
|
||||
is_furlough_person = '0' AND exit_status != '1' GROUP BY id_number ) bweh
|
||||
on bweh.project_id = bsc.pro_id
|
||||
AND bweh.sub_id = bsc.sub_id
|
||||
and bsr.v = bweh.team_id
|
||||
and bst.id = bweh.team_id
|
||||
LEFT JOIN ( SELECT id_number, pro_id FROM fc_face_contrast WHERE CURRENT_DAY = #{params.currentDay} GROUP BY
|
||||
id_number, CURRENT_DAY, pro_id ) ffc ON ffc.pro_id = bweh.project_id
|
||||
AND bweh.id_number = ffc.id_number
|
||||
|
|
@ -404,9 +397,7 @@
|
|||
AND bp.IS_ACTIVE = '1'
|
||||
LEFT JOIN bm_project_general po ON po.id = bp.project_general_id
|
||||
AND po.is_active = '1'
|
||||
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bwc.id
|
||||
AND bsr.is_active = '1'
|
||||
LEFT JOIN bm_sub_team bst ON bsr.v = bst.id
|
||||
LEFT JOIN bm_sub_team bst ON bs.id = bst.sub_id
|
||||
AND bst.IS_ACTIVE = '1'
|
||||
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id
|
||||
AND btur.IS_ACTIVE = '1'
|
||||
|
|
|
|||
Loading…
Reference in New Issue