首页模块SQL重新写

This commit is contained in:
方亮 2026-02-09 10:46:36 +08:00
parent 7a6ad8b80a
commit 500fb28055
4 changed files with 12 additions and 19 deletions

View File

@ -148,4 +148,5 @@ public class BuildProBean {
*/
private String collectId;
private Long buildProNum;
}

View File

@ -227,12 +227,12 @@ public class HomePageServiceImpl implements HomePageService {
public void getProMsgCache() {
List<ProMsgBean> list = dao.getProMsg();
//插入缓存
if(list.size()>0){
if(!list.isEmpty()){
dao.insertProMsgCache(list);
}
List<ProMsgBean> rankList = dao.getProRank();
//插入缓存
if(rankList.size()>0){
if(!rankList.isEmpty()){
dao.insertProRankCache(rankList);
}
}

View File

@ -166,8 +166,8 @@
LEFT JOIN bm_project_general bpg ON bpg.id = bp.project_general_id AND bpg.is_active = '1'
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 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 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
@ -375,6 +375,8 @@
COUNT( DISTINCT bst.id ) AS teamNum
FROM
bm_subcontractor bs
LEFT JOIN bm_sub_team bst ON bs.id = bst.sub_id
AND bst.IS_ACTIVE = '1'
LEFT JOIN bm_sub_contract bwc ON bwc.sub_id = bs.id
AND bwc.IS_ACTIVE = '1'
inner JOIN bm_project bp ON bwc.pro_id = bp.id
@ -388,10 +390,6 @@
bm_project_general AS po
WHERE po.is_active = '1'
) po ON po.id = bp.project_general_id
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
AND bst.IS_ACTIVE = '1'
WHERE
bs.IS_ACTIVE = '1'
<if test="subComId != null and subComId != '' ">

View File

@ -165,10 +165,7 @@
AND td.type = 'voltageLevel'
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 bsr.v = bst.id
LEFT JOIN bm_sub_team bst ON bsc.sub_id = bst.sub_id
AND bst.is_active = '1'
WHERE 1=1
<include refid="proWhere"></include>
@ -257,9 +254,7 @@
FROM bm_project_general AS po
WHERE po.is_active = '1'
) po ON po.id = bp.project_general_id
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 bwc.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'
@ -294,8 +289,7 @@
COUNT(DISTINCT ffc.id_number) as attPersonNum
FROM
bm_sub_team bst
LEFT JOIN bm_sub_relation bsr ON bst.id = bsr.v and bsr.is_active = '1'
LEFT JOIN bm_sub_contract bwc ON bsr.sub_contract_id = bwc.id
LEFT JOIN bm_sub_contract bwc ON bst.sub_id = bwc.sub_id
AND bwc.IS_ACTIVE = '1'
LEFT JOIN bm_subcontractor bs ON bwc.sub_id = bs.id
AND bwc.IS_ACTIVE = '1'
@ -487,8 +481,8 @@
SELECT DISTINCT id_number,project_id,sub_id,team_id,ein_time
FROM bm_worker_ein_history
WHERE ein_time &lt;= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
AND exit_time IS NULL
AND exit_status = - 1
AND is_furlough_person = '0'
AND exit_status != '1'
) w
LEFT JOIN fc_face_contrast fc
ON w.id_number = fc.ID_NUMBER