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

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

View File

@ -6,34 +6,30 @@
componentName-->
<select id="getComponentByBayPage" resultType="java.util.Map">
SELECT
*
t.*
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
1=1
1 = 1
<if test="stationCode != null and stationCode != ''">
AND t.station_code=#{stationCode}
AND t.station_code = #{stationCode}
</if>
<if test="areaId != null and areaId != ''">
AND t.area_id=#{areaId}
AND t.area_id = #{areaId}
</if>
<if test="bayId != null and bayId != ''">
AND t.bay_id=#{bayId}
AND t.bay_id = #{bayId}
</if>
<if test="mainDeviceId != null and mainDeviceId != ''">
AND t.main_device_id=#{mainDeviceId}
AND t.main_device_id = #{mainDeviceId}
</if>
<if test="componentName != null and componentName != ''">
AND t.component_name like concat('%',#{componentName},'%')
AND t.component_name LIKE CONCAT('%',#{componentName}, '%')
</if>
AND
component_id NOT IN (
SELECT
component_id
FROM
iis_algorithm_class_component
WHERE
algorithm_id = #{algorithmId})
AND aac.component_id IS NULL
</select>
</mapper>