吉安感知网项目-后端
xiebin
2026-04-03 a561d27fb9ec4ca0407a8131ec2edc9c4efefcc2
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
@@ -73,6 +73,7 @@
        on md.device_sn::text = d2.device_sn::text
        and d2.device_type = '0'
        <where>
             md.is_deleted = 0
            <if test="deviceIds != null and deviceIds.size() > 0">
                and md.id::text in
                <foreach item="item" collection="deviceIds" index="index" open="(" close=")" separator=",">
@@ -84,13 +85,11 @@
            </if>
            <if test="geom != null and geom != ''">
                /* 确保这里是第一个条件时,and 能被 MyBatis 正确处理,或者直接去掉这个 and */
                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}::text))
                AND ST_Intersects ( ST_SetSRID ( md.geom, 4326 ), ST_SetSRID ( ST_GeomFromText ( ${geom} ), 4326 ) )
            </if>
            <if test="deviceType != null and deviceType != '' ">
                and md.device_type::text = #{deviceType}::text
            </if>
            /* 将固定条件放在最前面或最后面,确保逻辑严健 */
            and md.is_deleted = 0
        </where>
    </select>