吉安感知网项目-后端
linwei
yesterday 51a551a7f8eae7654f973d45cd2fa2952774673d
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneMapper.xml
@@ -25,7 +25,10 @@
    <select id="selectFwDefenseScenePage" resultMap="fwDefenseSceneResultMap">
        select * from ja_fw_defense_scene
        select
            *
        from
            ja_fw_defense_scene
        <where>
                and is_deleted = 0
            <if test="param2.id != null and param2.id != ''">
@@ -37,55 +40,47 @@
            <if test="param2.sceneType != null and param2.sceneType != ''">
                and scene_type = #{param2.sceneType}
            </if>
            <if test="param2.longitude != null and param2.longitude != ''">
                and longitude = #{param2.longitude}
            </if>
            <if test="param2.latitude != null and param2.latitude != ''">
                and latitude = #{param2.latitude}
            </if>
            <if test="param2.defenseLeader != null and param2.defenseLeader != ''">
                and defense_leader like concat('%', #{param2.defenseLeader}, '%')
            </if>
            <if test="param2.leaderPhone != null and param2.leaderPhone != ''">
                and leader_phone = #{param2.leaderPhone}
            </if>
            <if test="param2.defenseArea != null and param2.defenseArea != ''">
                and defense_area = #{param2.defenseArea}
            </if>
            <if test="param2.deviceMode != null and param2.deviceMode != ''">
                and device_mode = #{param2.deviceMode}
            </if>
            <if test="param2.areaDivideIds != null and param2.areaDivideIds != ''">
                and area_divide_ids = #{param2.areaDivideIds}
            </if>
            <if test="param2.areaCode != null and param2.areaCode != ''">
                and area_code = #{param2.areaCode}
            </if>
            <if test="param2.createUser != null and param2.createUser != ''">
                and create_user = #{param2.createUser}
            </if>
            <if test="param2.createDept != null and param2.createDept != ''">
                and create_dept = #{param2.createDept}
            </if>
            <if test="param2.createTime != null and param2.createTime != ''">
                and create_time = #{param2.createTime}
            </if>
            <if test="param2.updateUser != null and param2.updateUser != ''">
                and update_user = #{param2.updateUser}
            </if>
            <if test="param2.updateTime != null and param2.updateTime != ''">
                and update_time = #{param2.updateTime}
            </if>
            <if test="param2.status != null and param2.status != ''">
                and status = #{param2.status}
            <if test="param2.deptList != null and param2.deptList.size > 0">
                and create_dept in
                <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
                    #{deptId}
                </foreach>
            </if>
        </where>
    </select>
    <select id="selectFwDefenseSceneList" resultMap="fwDefenseSceneResultMap">
        select ds.* from ja_fw_defense_scene ds
        select
            ds.*
        from
            ja_fw_defense_scene ds
        <where>
            ds.is_deleted = 0
                ds.is_deleted = 0
            <if test="deptList != null and deptList.size > 0">
                and ds.create_dept in
                <foreach collection="deptList" item="deptId" open="(" separator="," close=")">
                    #{deptId}
                </foreach>
            </if>
            <if test="unbound != null and unbound == 1">
                and (
                    not exists (
                        select 1
                        from ja_fw_defense_scene_manage dsm
                        where dsm.is_deleted = 0
                          and dsm.defense_scene_id::VARCHAR = ds.id::VARCHAR
                    )
                    <if test="sceneManageId != null">
                        or exists (
                            select 1
                            from ja_fw_defense_scene_manage dsm
                            where dsm.is_deleted = 0
                              and dsm.id = #{sceneManageId}
                              and dsm.defense_scene_id::VARCHAR = ds.id::VARCHAR
                        )
                    </if>
                )
            </if>
            <if test="filterSelected != null and filterSelected == 1">
                and (
                    not exists (
@@ -94,7 +89,7 @@
                        where dz.is_deleted = 0
                          and dz.defense_scene_ids is not null
                          and dz.defense_scene_ids != ''
                          and find_in_set(ds.id, dz.defense_scene_ids)
                          and ds.id = ANY(string_to_array(dz.defense_scene_ids, ',')::bigint[])
                    )
                    <if test="zoneId != null">
                        or exists (
@@ -104,7 +99,7 @@
                              and dz.id = #{zoneId}
                              and dz.defense_scene_ids is not null
                              and dz.defense_scene_ids != ''
                              and find_in_set(ds.id, dz.defense_scene_ids)
                              and ds.id = ANY(string_to_array(dz.defense_scene_ids, ',')::bigint[])
                        )
                    </if>
                )
@@ -112,7 +107,7 @@
            <if test="areaId != null and (filterSelected == null or filterSelected != 1)">
                and ds.area_divide_ids is not null
                and ds.area_divide_ids != ''
                and find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
                and #{areaId} = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            </if>
        </where>
    </select>