吉安感知网项目-后端
linwei
2026-04-02 e95775fca40b69671c259594742a2bce72a6afe3
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
@@ -69,22 +69,24 @@
            d2.height as height
        from
            ja_gd_manage_device md
        left join ja_gd_manage_device d2 on md.device_sn::VARCHAR = d2.device_sn::VARCHAR and d2.device_type = '0'
        /* 修改点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'
        <where>
            <if test="deviceIds != null and deviceIds.size() > 0">
                and md.id in
                and md.id::text in
                <foreach item="item" collection="deviceIds" index="index" open="(" close=")" separator=",">
                    #{item}
                    #{item}::text
                </foreach>
            </if>
            <if test="devicePayload != null and devicePayload != ''">
                and md.device_payload like concat('%',#{devicePayload},'%')
            </if>
            <if test="geom != null and geom != ''">
                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}))
                /* 修改点2:增加显式类型转换 ::text,并建议指定 SRID (如 4326) */
                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}::text, 4326))
            </if>
            <if test="deviceType != null and deviceType != '' ">
                and md.device_type = #{deviceType}
                and md.device_type::text = #{deviceType}::text
            </if>
                and md.is_deleted = 0
        </where>