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

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--> 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 != ''">
AND t.station_code=#{stationCode} AND t.station_code = #{stationCode}
</if> </if>
<if test="areaId != null and areaId != ''"> <if test="areaId != null and areaId != ''">
AND t.area_id=#{areaId} AND t.area_id = #{areaId}
</if> </if>
<if test="bayId != null and bayId != ''"> <if test="bayId != null and bayId != ''">
AND t.bay_id=#{bayId} AND t.bay_id = #{bayId}
</if> </if>
<if test="mainDeviceId != null and mainDeviceId != ''"> <if test="mainDeviceId != null and mainDeviceId != ''">
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>