优化算法分类部件查询逻辑

This commit is contained in:
weitang 2025-05-15 10:08:27 +08:00
parent 19b44e2232
commit a2d128d3f5

View File

@ -6,9 +6,12 @@
componentName--> componentName-->
<select id="getComponentByBayPage" resultType="java.util.Map"> <select id="getComponentByBayPage" resultType="java.util.Map">
SELECT SELECT
* t.*
FROM FROM
iis_substation_component iis_substation_component t -- 明确主表别名
LEFT JOIN iis_algorithm_class_component aac
ON t.component_id = aac.component_id
AND aac.algorithm_id = #{algorithmId} -- 提前过滤子查询
WHERE WHERE
1 = 1 1 = 1
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
@ -24,16 +27,9 @@
AND t.main_device_id = #{mainDeviceId} AND t.main_device_id = #{mainDeviceId}
</if> </if>
<if test="componentName != null and componentName != ''"> <if test="componentName != null and componentName != ''">
AND t.component_name like concat('%',#{componentName},'%') AND t.component_name LIKE CONCAT('%',#{componentName}, '%')
</if> </if>
AND AND aac.component_id IS NULL
component_id NOT IN (
SELECT
component_id
FROM
iis_algorithm_class_component
WHERE
algorithm_id = #{algorithmId})
</select> </select>
</mapper> </mapper>