This commit is contained in:
mashuai 2025-11-10 17:24:31 +08:00
parent 024b9a77ac
commit a848e238e8
2 changed files with 21 additions and 14 deletions

View File

@ -183,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE WHERE
unit_id = #{unitId} unit_id = #{unitId}
and project_id = #{projectId} and project_id = #{projectId}
LIMIT 1
</select> </select>
<select id="queryByTeamIdAndProjectIdCl" resultType="com.bonus.material.basic.domain.BmAgreementInfo"> <select id="queryByTeamIdAndProjectIdCl" resultType="com.bonus.material.basic.domain.BmAgreementInfo">

View File

@ -1023,13 +1023,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sd.del_flag = '0' sd.del_flag = '0'
AND sd.`status` = '0' AND sd.`status` = '0'
AND bmp.del_flag = '0' AND bmp.del_flag = '0'
AND bmp.pro_id IN ( AND (
SELECT bai.project_id -- 条件1如果 bp.pro_id 不在 bm_agreement_info 中,该条件恒为真(不过滤)
FROM bm_agreement_info bai NOT EXISTS (SELECT 1 FROM bm_agreement_info WHERE project_id = bmp.pro_id)
INNER JOIN slt_agreement_info sai ON bai.agreement_id = sai.agreement_id -- 条件2如果 bp.pro_id 在 bm_agreement_info 中,则应用 IN 子查询过滤
WHERE sai.is_slt = 0 OR bmp.pro_id IN (
and bai.is_show != 0 SELECT project_id
) FROM bm_agreement_info
WHERE is_slt = 0
AND is_show != 0
))
<if test="projectIdList != null and projectIdList.size() > 0"> <if test="projectIdList != null and projectIdList.size() > 0">
AND bmp.external_id in AND bmp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")"> <foreach item="item" collection="projectIdList" open="(" separator="," close=")">
@ -1050,13 +1053,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND sd.del_flag = '0' AND sd.del_flag = '0'
AND sd.`status` = '0' AND sd.`status` = '0'
AND bmp.del_flag = '0' AND bmp.del_flag = '0'
AND bmp.pro_id IN ( AND (
SELECT bai.project_id -- 条件1如果 bp.pro_id 不在 bm_agreement_info 中,该条件恒为真(不过滤)
FROM bm_agreement_info bai NOT EXISTS (SELECT 1 FROM bm_agreement_info WHERE project_id = bmp.pro_id)
INNER JOIN slt_agreement_info sai ON bai.agreement_id = sai.agreement_id -- 条件2如果 bp.pro_id 在 bm_agreement_info 中,则应用 IN 子查询过滤
WHERE sai.is_slt = 0 OR bmp.pro_id IN (
and bai.is_show != 0 SELECT project_id
) FROM bm_agreement_info
WHERE is_slt = 0
AND is_show != 0
))
<if test="projectIdList != null and projectIdList.size() > 0"> <if test="projectIdList != null and projectIdList.size() > 0">
AND bmp.external_id in AND bmp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")"> <foreach item="item" collection="projectIdList" open="(" separator="," close=")">