公海列表SQL优化

This commit is contained in:
苏竹红
2023-11-23 18:13:57 +08:00
parent c8d7069369
commit 25a4a0cc4f

View File

@@ -680,17 +680,19 @@
SELECT
<include refid="Base_Column_List"></include>
FROM hy_partner_line_info h1
WHERE h1.create_time = (
SELECT MAX(h2.create_time)
FROM hy_partner_line_info h2
WHERE h1.partner_id = h2.partner_id
and (h2.deleted = 1 or (h2.deleted=0 and h2.line_status=0 and h2.close_time is not null))
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" item="partnerId" open="and h1.partner_id in (" close=")" separator=",">
#{partnerId}
</foreach>
</if>
)
<where>
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" item="partnerId" open="and h1.partner_id in (" close=")" separator=",">
#{partnerId}
</foreach>
</if>
and h1.create_time = (
SELECT MAX(h2.create_time)
FROM hy_partner_line_info h2
WHERE h1.partner_id = h2.partner_id
and (h2.deleted = 1 or (h2.deleted=0 and h2.line_status=0 and h2.close_time is not null)))
</where>
</select>