吉安感知网项目-后端
linwei
2026-02-09 0b5742177d3a663435da88c77f21c9a2649b4967
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneManageMapper.xml
@@ -29,6 +29,12 @@
            <if test="param2.name != null and param2.name != ''">
                and dsm.scene_name like concat('%', #{param2.name}, '%')
            </if>
            <if test="param2.deptList != null and param2.deptList.size > 0">
                and dsm.create_dept in
                <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
                    #{deptId}
                </foreach>
            </if>
        </where>
    </select>
@@ -78,10 +84,45 @@
                ad.device_ids
            FROM ja_fw_defense_scene_manage dsm
            LEFT JOIN ja_fw_defense_scene ds ON ds.id = dsm.defense_scene_id AND ds.is_deleted = 0
            LEFT JOIN ja_fw_area_divide ad ON FIND_IN_SET(ad.id, ds.area_divide_ids) > 0 AND ad.is_deleted = 0
            LEFT JOIN ja_fw_area_divide ad ON ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[]) AND ad.is_deleted = 0
            WHERE dsm.id = #{id}
        ) ad ON CHAR_LENGTH(ad.device_ids) - CHAR_LENGTH(REPLACE(ad.device_ids, ',', '')) >= numbers.n - 1
        WHERE ad.device_ids IS NOT NULL AND ad.device_ids != ''
    </select>
    <select id="selectFwDefenseSceneManageCockpitList" resultType="org.sxkj.fw.area.vo.FwDefenseSceneManageVO">
        select
        dsm.*,
        ds.scene_name as defense_scene_name
        from ja_fw_defense_scene_manage dsm
        left join ja_fw_defense_scene ds on ds.id = dsm.defense_scene_id and ds.is_deleted = 0
        left join ja_fw_area_divide ad on ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[]) and ad.is_deleted = 0
        inner join (
                SELECT
                    d.id
                FROM
                    ja_fw_device d
                WHERE
                    d.is_deleted = 0
                    AND d.is_enabled = 1
                    AND d.final_outbound_area IS NOT NULL
                <if test="regionCode != null and regionCode != ''">
                    and ( d.final_outbound_area_code like concat(#{regionCode},'%')
                    <if test="currentDeptId != null and currentDeptId != '' ">
                        or d.id in (
                        SELECT device_id FROM ja_fw_device_per_share
                        WHERE loan_to_dept_id = #{currentDeptId}
                        AND is_deleted = 0
                        )
                    </if>
                    )
                </if>
                GROUP BY
                d.id
            ) dd on dd.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
        <where>
            dsm.is_deleted = 0
        </where>
    </select>
</mapper>