吉安感知网项目-后端
linwei
2026-06-03 30dc5b1fa3bb545cb1c2f2445f26cb033d8295b9
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
@@ -73,6 +73,9 @@
        on md.device_sn::text = d2.device_sn::text
        and d2.device_type = '0'
        <where>
             md.is_deleted = 0
            AND md.child_sn IS NOT NULL
            AND trim(md.child_sn) != ''
            <if test="deviceIds != null and deviceIds.size() > 0">
                and md.id::text in
                <foreach item="item" collection="deviceIds" index="index" open="(" close=")" separator=",">
@@ -83,14 +86,11 @@
                and md.device_payload like concat('%', #{devicePayload}, '%')
            </if>
            <if test="geom != null and geom != ''">
                /* 确保这里是第一个条件时,and 能被 MyBatis 正确处理,或者直接去掉这个 and */
                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}::text))
                AND public.st_intersects ( md.geom, public.st_geomfromtext(#{geom}::text, 4326))
            </if>
            <if test="deviceType != null and deviceType != '' ">
                and md.device_type::text = #{deviceType}::text
            </if>
            /* 将固定条件放在最前面或最后面,确保逻辑严健 */
            and md.is_deleted = 0
        </where>
    </select>