施工人员管理查询不包含临时人员

This commit is contained in:
itcast 2026-02-03 18:00:07 +08:00
parent 7dbda93b19
commit 80a9e2e166
1 changed files with 10 additions and 8 deletions

View File

@ -803,9 +803,10 @@
LEFT JOIN LEFT JOIN
bm_project bp ON bp.project_general_id = bpg.id AND bp.is_active = '1' bm_project bp ON bp.project_general_id = bpg.id AND bp.is_active = '1'
LEFT JOIN ( LEFT JOIN (
SELECT project_id, id_number, ein_time, IS_ACTIVE SELECT a.project_id, a.id_number, a.ein_time, a.IS_ACTIVE
FROM bm_worker_ein_history FROM bm_worker_ein_history a
WHERE IS_ACTIVE IN ('0', '1') left join bm_worker b on a.id_number = b.id_number
WHERE a.IS_ACTIVE IN ('0', '1') and b.worker_type != '0'
) weh ON weh.project_id = bp.id ) weh ON weh.project_id = bp.id
-- LEFT JOIN -- LEFT JOIN
-- bm_worker_ein_history bweh1 ON bweh1.project_id = bp.id AND bweh1.IS_ACTIVE = '1' -- bm_worker_ein_history bweh1 ON bweh1.project_id = bp.id AND bweh1.IS_ACTIVE = '1'
@ -890,7 +891,7 @@
GROUP BY id_number GROUP BY id_number
) latest ON bweh.id_number = latest.id_number AND bweh.ein_time = latest.latest_ein_time ) latest ON bweh.id_number = latest.id_number AND bweh.ein_time = latest.latest_ein_time
WHERE bweh.project_id = #{ params.proId} WHERE bweh.project_id = #{ params.proId}
) latest ON bw.id_number = latest.id_number ) latest ON bw.id_number = latest.id_number and bw.worker_type != '0'
LEFT JOIN bm_worker_contract bwc ON bwc.idCard = bw.id_number AND bwc.is_active = '1' LEFT JOIN bm_worker_contract bwc ON bwc.idCard = bw.id_number AND bwc.is_active = '1'
LEFT JOIN bm_worker_bank bwb ON bwb.ID_NUMBER = bw.id_number LEFT JOIN bm_worker_bank bwb ON bwb.ID_NUMBER = bw.id_number
LEFT JOIN t_dict td ON td.id = bw.post_id AND td.is_active = '1' LEFT JOIN t_dict td ON td.id = bw.post_id AND td.is_active = '1'
@ -1300,7 +1301,7 @@
GROUP BY id_number GROUP BY id_number
) latest ON bweh.id_number = latest.id_number AND bweh.ein_time = latest.latest_ein_time ) latest ON bweh.id_number = latest.id_number AND bweh.ein_time = latest.latest_ein_time
WHERE bweh.project_id = #{ params.proId} WHERE bweh.project_id = #{ params.proId}
) latest ON bw.id_number = latest.id_number ) latest ON bw.id_number = latest.id_number and bw.worker_type != '0'
LEFT JOIN bm_worker_contract bwc ON bwc.idCard = bw.id_number AND bwc.is_active = '1' LEFT JOIN bm_worker_contract bwc ON bwc.idCard = bw.id_number AND bwc.is_active = '1'
LEFT JOIN bm_worker_bank bwb ON bwb.ID_NUMBER = bw.id_number LEFT JOIN bm_worker_bank bwb ON bwb.ID_NUMBER = bw.id_number
LEFT JOIN t_dict td ON td.id = bw.post_id AND td.is_active = '1' LEFT JOIN t_dict td ON td.id = bw.post_id AND td.is_active = '1'
@ -1522,9 +1523,10 @@
LEFT JOIN LEFT JOIN
bm_project bp ON bp.project_general_id = bpg.id AND bp.is_active = '1' bm_project bp ON bp.project_general_id = bpg.id AND bp.is_active = '1'
LEFT JOIN ( LEFT JOIN (
SELECT project_id, id_number, ein_time, IS_ACTIVE SELECT a.project_id, a.id_number, a.ein_time, a.IS_ACTIVE
FROM bm_worker_ein_history FROM bm_worker_ein_history a
WHERE IS_ACTIVE IN ('0', '1') left join bm_worker b on a.id_number = b.id_number
WHERE a.IS_ACTIVE IN ('0', '1') and b.worker_type != '0'
) weh ON weh.project_id = bp.id ) weh ON weh.project_id = bp.id
-- LEFT JOIN -- LEFT JOIN
-- bm_worker_ein_history bweh1 ON bweh1.project_id = bp.id AND bweh1.IS_ACTIVE = '1' -- bm_worker_ein_history bweh1 ON bweh1.project_id = bp.id AND bweh1.IS_ACTIVE = '1'