吉安感知网项目-后端
linwei
2026-06-23 ebeb43ea497fafc448c827d1de6796bcaa4e0b52
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
@@ -69,9 +69,13 @@
        d2.height as height
        from
        ja_gd_manage_device md
        /* 修改点1:关联条件双向转型 text(规避之前的 bigint = varchar 错误) */
        left join ja_gd_manage_device d2 on md.device_sn::text = d2.device_sn::text and d2.device_type = '0'
        left join ja_gd_manage_device d2
        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=",">
@@ -79,16 +83,14 @@
                </foreach>
            </if>
            <if test="devicePayload != null and devicePayload != ''">
                and md.device_payload like concat('%',#{devicePayload},'%')
                and md.device_payload like concat('%', #{devicePayload}, '%')
            </if>
            <if test="geom != null and geom != ''">
                /* 修改点2:增加显式类型转换 ::text,并建议指定 SRID (如 4326) */
                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}::text, 4326))
                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>