<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.css.simulation.resource.server.infra.db.mysql.mapper.SceneNaturalMapper">

    <insert id="saveSceneNatural" parameterType="api.common.pojo.po.scene.SceneNaturalPO">
        insert into simulation.scene_natural
        (natural_id, natural_name, weather, backlight,
         light_change, road_type, road_matrrial, driveway_num,
         driveway_type, road_flatness, road_curvature, ramp,
         intersection_type, plane_intersection, bridge, tunnel,
         speed_limit, min_speed_limit, no_entry, no_stopping,
         left_lane_line, right_lane_line, conductor_marking, pedestrian_crossing,
         traffic_light, deceleration_marking, pavement_condition, natural_disaster,
         road_safety_signs, safety_warning_board, traffic_accident, patency,
         special_vehicle_yield, violation, double_flashing_car, self_behavior,
         target_behavior, create_user_id, create_time, modify_user_id, modify_time,
         is_deleted, share, video_preview, video_address, osgb_address, xodr_address, xosc_address,
         json_address, max_time)
        values (#{naturalId,jdbcType=VARCHAR}, #{naturalName,jdbcType=VARCHAR}, #{weather,jdbcType=VARCHAR},
                #{backlight,jdbcType=VARCHAR},
                #{lightChange,jdbcType=VARCHAR}, #{roadType,jdbcType=VARCHAR}, #{roadMatrrial,jdbcType=VARCHAR},
                #{drivewayNum,jdbcType=VARCHAR},
                #{drivewayType,jdbcType=VARCHAR}, #{roadFlatness,jdbcType=VARCHAR}, #{roadCurvature,jdbcType=VARCHAR},
                #{ramp,jdbcType=VARCHAR},
                #{intersectionType,jdbcType=VARCHAR}, #{planeIntersection,jdbcType=VARCHAR}, #{bridge,jdbcType=VARCHAR},
                #{tunnel,jdbcType=VARCHAR},
                #{speedLimit,jdbcType=VARCHAR}, #{minSpeedLimit,jdbcType=VARCHAR}, #{noEntry,jdbcType=VARCHAR},
                #{noStopping,jdbcType=VARCHAR},
                #{leftLaneLine,jdbcType=VARCHAR}, #{rightLaneLine,jdbcType=VARCHAR},
                #{conductorMarking,jdbcType=VARCHAR}, #{pedestrianCrossing,jdbcType=VARCHAR},
                #{trafficLight,jdbcType=VARCHAR}, #{decelerationMarking,jdbcType=VARCHAR},
                #{pavementCondition,jdbcType=VARCHAR}, #{naturalDisaster,jdbcType=VARCHAR},
                #{roadSafetySigns,jdbcType=VARCHAR}, #{safetyWarningBoard,jdbcType=VARCHAR},
                #{trafficAccident,jdbcType=VARCHAR}, #{patency,jdbcType=VARCHAR},
                #{specialVehicleYield,jdbcType=VARCHAR}, #{violation,jdbcType=VARCHAR},
                #{doubleFlashingCar,jdbcType=VARCHAR}, #{selfBehavior,jdbcType=VARCHAR},
                #{targetBehavior,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR}, #{createTime},
                #{modifyUserId,jdbcType=VARCHAR}, #{modifyTime},
                #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR}, #{videoPreview,jdbcType=VARCHAR},
                #{videoAddress,jdbcType=VARCHAR}, #{osgbAddress,jdbcType=VARCHAR},
                #{xodrAddress,jdbcType=VARCHAR}, #{xoscAddress,jdbcType=VARCHAR}, #{jsonAddress,jdbcType=VARCHAR},
                #{maxTime,jdbcType=VARCHAR})
    </insert>

    <insert id="saveSceneNaturalList" parameterType="java.lang.String">
        insert into simulation.scene_natural
        (natural_id,natural_name,weather,backlight,
        light_change,road_type,road_matrrial,driveway_num,
        driveway_type,road_flatness,road_curvature,ramp,
        intersection_type,plane_intersection,bridge,tunnel,
        speed_limit,min_speed_limit,no_entry,no_stopping,
        left_lane_line,right_lane_line,conductor_marking,pedestrian_crossing,
        traffic_light,deceleration_marking,pavement_condition,natural_disaster,
        road_safety_signs,safety_warning_board,traffic_accident,patency,
        special_vehicle_yield,violation,double_flashing_car,self_behavior,
        target_behavior,create_user_id,create_time,modify_user_id,modify_time,
        is_deleted,share,video_preview,video_address,osgb_address,xodr_address,xosc_address,
        json_address,max_time)
        values
        <foreach collection="list" index="index" item="item" separator=",">
            (#{item.naturalId,jdbcType=VARCHAR},#{item.naturalName,jdbcType=VARCHAR},#{item.weather,jdbcType=VARCHAR},
            #{item.backlight,jdbcType=VARCHAR},
            #{item.lightChange,jdbcType=VARCHAR},
            #{item.roadType,jdbcType=VARCHAR},#{item.roadMatrrial,jdbcType=VARCHAR},#{item.drivewayNum,jdbcType=VARCHAR},
            #{item.drivewayType,jdbcType=VARCHAR},
            #{item.roadFlatness,jdbcType=VARCHAR},#{item.roadCurvature,jdbcType=VARCHAR},#{item.ramp,jdbcType=VARCHAR},
            #{item.intersectionType,jdbcType=VARCHAR},
            #{item.planeIntersection,jdbcType=VARCHAR},#{item.bridge,jdbcType=VARCHAR},#{item.tunnel,jdbcType=VARCHAR},
            #{item.speedLimit,jdbcType=VARCHAR},
            #{item.minSpeedLimit,jdbcType=VARCHAR},#{item.noEntry,jdbcType=VARCHAR},#{item.noStopping,jdbcType=VARCHAR},
            #{item.leftLaneLine,jdbcType=VARCHAR},
            #{item.rightLaneLine,jdbcType=VARCHAR},#{item.conductorMarking,jdbcType=VARCHAR},#{item.pedestrianCrossing,jdbcType=VARCHAR},
            #{item.trafficLight,jdbcType=VARCHAR},
            #{item.decelerationMarking,jdbcType=VARCHAR},#{item.pavementCondition,jdbcType=VARCHAR},#{item.naturalDisaster,jdbcType=VARCHAR},
            #{item.roadSafetySigns,jdbcType=VARCHAR},
            #{item.safetyWarningBoard,jdbcType=VARCHAR},#{item.trafficAccident,jdbcType=VARCHAR},#{item.patency,jdbcType=VARCHAR},
            #{item.specialVehicleYield,jdbcType=VARCHAR},
            #{item.violation,jdbcType=VARCHAR},#{item.doubleFlashingCar,jdbcType=VARCHAR},#{item.selfBehavior,jdbcType=VARCHAR},

            #{item.targetBehavior,jdbcType=VARCHAR},
            #{item.createUserId,jdbcType=VARCHAR},#{item.createTime},#{item.modifyUserId,jdbcType=VARCHAR},#{item.modifyTime},

            #{item.isDeleted,jdbcType=VARCHAR},
            #{item.share,jdbcType=VARCHAR},#{item.videoPreview,jdbcType=VARCHAR},#{item.videoAddress,jdbcType=VARCHAR},#{item.osgbAddress,jdbcType=VARCHAR},
            #{item.xodrAddress,jdbcType=VARCHAR},
            #{item.xoscAddress,jdbcType=VARCHAR},#{item.jsonAddress,jdbcType=VARCHAR},#{item.maxTime,jdbcType=VARCHAR})
        </foreach>
    </insert>
    <update id="deleteBySceneNames">
        update scene_natural
        set is_deleted = '1',
        modify_user_id = #{modifyUserId},
        modify_time = #{modifyTime}
        where is_deleted = '0' and natural_name in
        <foreach item="item" collection="sceneNames" separator="," open="(" close=")">
            #{item}
        </foreach>
    </update>


    <select id="querySceneNaturalList" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from simulation.scene_natural
        <where>
            is_deleted = '0'
            <if test="naturalName != null and naturalName != ''">
                and natural_name like CONCAT('%',#{naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="weather != null and weather.size()>0 ">
                and weather in
                <foreach collection="weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="backlight != null and backlight.size()>0">
                and backlight in
                <foreach collection="backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="lightChange != null and lightChange.size()>0">
                and light_change in
                <foreach collection="lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadType != null and roadType.size()>0">
                and road_type in
                <foreach collection="roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadMatrrial != null and roadMatrrial.size()>0">
                and road_matrrial in
                <foreach collection="roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="drivewayNum != null and drivewayNum.size()>0">
                and driveway_num in
                <foreach collection="drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="drivewayType != null and drivewayType.size()>0">
                and driveway_type in
                <foreach collection="drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadFlatness != null and roadFlatness.size()>0">
                and road_flatness in
                <foreach collection="roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadCurvature != null and roadCurvature.size()>0">
                and road_curvature in
                <foreach collection="roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="ramp != null and ramp.size()>0">
                and ramp in
                <foreach collection="ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="intersectionType != null and intersectionType.size()>0">
                and intersection_type in
                <foreach collection="intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="planeIntersection != null and planeIntersection.size()>0">
                and plane_intersection in
                <foreach collection="planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="bridge != null and bridge.size()>0">
                and bridge in
                <foreach collection="bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="tunnel != null and tunnel.size()>0">
                and tunnel in
                <foreach collection="tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="speedLimit != null and speedLimit.size()>0">
                and speed_limit in
                <foreach collection="speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="minSpeedLimit != null and minSpeedLimit.size()>0">
                and min_speed_limit in
                <foreach collection="minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="noEntry != null and noEntry.size()>0">
                and no_entry in
                <foreach collection="noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="noStopping != null and noStopping.size()>0">
                and no_stopping in
                <foreach collection="noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="leftLaneLine != null and leftLaneLine.size()>0">
                and left_lane_line in
                <foreach collection="leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="rightLaneLine != null and rightLaneLine.size()>0">
                and right_lane_line in
                <foreach collection="rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="conductorMarking != null and conductorMarking.size()>0">
                and conductor_marking in
                <foreach collection="conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="pedestrianCrossing != null and pedestrianCrossing.size()>0">
                and pedestrian_crossing in
                <foreach collection="pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="trafficLight != null and trafficLight.size()>0">
                and traffic_light in
                <foreach collection="trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="decelerationMarking != null and decelerationMarking.size()>0">
                and deceleration_marking in
                <foreach collection="decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="pavementCondition != null and pavementCondition.size()>0">
                and pavement_condition in
                <foreach collection="pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="naturalDisaster != null and naturalDisaster.size()>0">
                and natural_disaster in
                <foreach collection="naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadSafetySigns != null and roadSafetySigns.size()>0">
                and road_safety_signs in
                <foreach collection="roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="safetyWarningBoard != null and safetyWarningBoard.size()>0">
                and safety_warning_board in
                <foreach collection="safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="trafficAccident != null and trafficAccident.size()>0">
                and traffic_accident in
                <foreach collection="trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="patency != null and patency.size()>0">
                and patency in
                <foreach collection="patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="specialVehicleYield != null and specialVehicleYield.size()>0">
                and special_vehicle_yield in
                <foreach collection="specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="violation != null and violation.size()>0">
                and violation in
                <foreach collection="violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="doubleFlashingCar != null and doubleFlashingCar.size()>0">
                and double_flashing_car in
                <foreach collection="doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="selfBehavior != null and selfBehavior.size()>0">
                and
                <foreach collection="selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="targetBehavior != null and targetBehavior.size()>0">
                and
                <foreach collection="targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="ids != null and ids.length>0">
                and natural_id in
                <foreach collection="ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="allSceneNames != null and allSceneNames.length>0">
                and natural_name in
                <foreach collection="allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="AllIds != null and AllIds.size()>0">
                and natural_id in
                <foreach collection="AllIds" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="share != null and share==0">
                and share =#{share}
            </if>
            <if test="share != null and share!= '' and share!=0">
                and share !='0'
            </if>
            <if test="userId != null and userId != ''">
                and create_user_id =#{userId}
            </if>
            <if test="needComplexity != null and needComplexity != ''">
                and natural_id in (select scene_id from scene_complexity where is_deleted = '0'
                <if test="minComplexity != null and minComplexity != ''">
                    AND  complexity+0 >= #{minComplexity}
                </if>
                <if test="maxComplexity != null and maxComplexity != ''">
                    AND  complexity+0 &lt;=  #{maxComplexity}
                </if>
                <if test="complexityLevel != null and complexityLevel != ''">
                    AND complexity_level+0 >=  #{complexityLevel}
                </if>
                )
            </if>
            <if test="needRisk != null and needRisk != ''">
                and natural_id in (select scene_id from scene_complexity where is_deleted = '0'
                <if test="minRisk != null and minRisk != ''">
                    AND risk+0 >= #{minRisk}
                </if>
                <if test="maxRisk != null and maxRisk != ''">
                    AND risk+0 &lt;=  #{maxRisk}
                </if>
                <if test="riskLevel != null and riskLevel != ''">
                    AND risk_level+0 >=  #{riskLevel}
                </if>
                )
            </if>
            order by create_time,natural_name desc
        </where>
    </select>

    <update id="deleteSceneNatural" parameterType="api.common.pojo.po.scene.SceneNaturalPO">
        update simulation.scene_natural
        <set>
            <if test="isDeleted != null and isDeleted!=''">
                is_deleted = #{isDeleted,jdbcType=VARCHAR},
            </if>
            <if test="modifyUserId != null and modifyUserId!=''">
                modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
            </if>
            <if test="modifyTime != null">
                modify_time = #{modifyTime},
            </if>
        </set>
        where natural_id = #{naturalId,jdbcType=VARCHAR}
    </update>


    <select id="querySceneNaturaByName" parameterType="api.common.pojo.po.scene.SceneNaturalPO"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select natural_id,natural_name,weather,backlight,
        light_change,road_type,road_matrrial,driveway_num,
        driveway_type,road_flatness,road_curvature,ramp,
        intersection_type,plane_intersection,bridge,tunnel,
        speed_limit,min_speed_limit,no_entry,no_stopping,
        left_lane_line,right_lane_line,conductor_marking,pedestrian_crossing,
        traffic_light,deceleration_marking,pavement_condition,natural_disaster,
        road_safety_signs,safety_warning_board,traffic_accident,patency,
        special_vehicle_yield,violation,double_flashing_car,self_behavior,
        target_behavior,create_user_id,create_time,modify_user_id,modify_time,
        is_deleted,share,video_preview,video_address,osgb_address,xodr_address,xosc_address,
        json_address,max_time
        from simulation.scene_natural
        <where>
            is_deleted = '0'
            <if test="naturalName != null and naturalName!=''">
                and natural_name =#{naturalName}
            </if>
            <if test="share != null and share==0">
                and share =#{share}
            </if>
            <if test="share != null and share!= '' and share!=0">
                and share !='0'
            </if>
        </where>
    </select>

    <select id="selectAllByName" parameterType="api.common.pojo.po.scene.SceneNaturalPO"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select natural_id,natural_name,weather,backlight,
        light_change,road_type,road_matrrial,driveway_num,
        driveway_type,road_flatness,road_curvature,ramp,
        intersection_type,plane_intersection,bridge,tunnel,
        speed_limit,min_speed_limit,no_entry,no_stopping,
        left_lane_line,right_lane_line,conductor_marking,pedestrian_crossing,
        traffic_light,deceleration_marking,pavement_condition,natural_disaster,
        road_safety_signs,safety_warning_board,traffic_accident,patency,
        special_vehicle_yield,violation,double_flashing_car,self_behavior,
        target_behavior,create_user_id,create_time,modify_user_id,modify_time,
        is_deleted,share,video_preview,video_address,osgb_address,xodr_address,xosc_address,
        json_address,max_time
        from simulation.scene_natural
        <where>
            is_deleted = '0'
            <if test="naturalName != null and naturalName!=''">
                and natural_name =#{naturalName}
            </if>
            <if test="share != null and share==0">
                and share =#{share}
            </if>
            <if test="share != null and share!= '' and share!=0">
                and share !='0'
            </if>
        </where>
    </select>

    <select id="querySceneNumBySy" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
            resultType="java.lang.Integer">
        select SUM(num) from(
        select COUNT(1) AS num from simulation.scene_natural
        <where>is_deleted = '0' and share='0'
            <if test="createUserId != null and createUserId!=''">
                and create_user_id =#{createUserId}
            </if>
        </where>
        union all
        select COUNT(1) AS num from simulation.scene_accident
        <where>is_deleted = '0' and share='0'
            <if test="createUserId != null and createUserId!=''">
                and create_user_id =#{createUserId}
            </if>
        </where>
        union all
        select COUNT(1) AS num from simulation.scene_standards_regulations
        <where>is_deleted = '0' and share='0'
            <if test="createUserId != null and createUserId!=''">
                and create_user_id =#{createUserId}
            </if>
        </where>
        union all
        select COUNT(1) AS num from simulation.scene_general_template
        <where>is_deleted = '0' and share='0'
            <if test="createUserId != null and createUserId!=''">
                and create_user_id =#{createUserId}
            </if>
        </where>
        ) a
    </select>


    <select id="querySceneNaturalListByBqAndXlk" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from simulation.scene_natural
        <where>
            <if test="po.naturalName != null and po.naturalName != ''">
                natural_name like CONCAT('%',#{po.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="po.weather != null and po.weather.size()>0 ">
                and weather in
                <foreach collection="po.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.backlight != null and po.backlight.size()>0">
                and backlight in
                <foreach collection="po.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.lightChange != null and po.lightChange.size()>0">
                and light_change in
                <foreach collection="po.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadType != null and po.roadType.size()>0">
                and road_type in
                <foreach collection="po.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadMatrrial != null and po.roadMatrrial.size()>0">
                and road_matrrial in
                <foreach collection="po.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.drivewayNum != null and po.drivewayNum.size()>0">
                and driveway_num in
                <foreach collection="po.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.drivewayType != null and po.drivewayType.size()>0">
                and driveway_type in
                <foreach collection="po.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadFlatness != null and po.roadFlatness.size()>0">
                and road_flatness in
                <foreach collection="po.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadCurvature != null and po.roadCurvature.size()>0">
                and road_curvature in
                <foreach collection="po.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.ramp != null and po.ramp.size()>0">
                and ramp in
                <foreach collection="po.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.intersectionType != null and po.intersectionType.size()>0">
                and intersection_type in
                <foreach collection="po.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.planeIntersection != null and po.planeIntersection.size()>0">
                and plane_intersection in
                <foreach collection="po.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.bridge != null and po.bridge.size()>0">
                and bridge in
                <foreach collection="po.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.tunnel != null and po.tunnel.size()>0">
                and tunnel in
                <foreach collection="po.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.speedLimit != null and po.speedLimit.size()>0">
                and speed_limit in
                <foreach collection="po.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.minSpeedLimit != null and po.minSpeedLimit.size()>0">
                and min_speed_limit in
                <foreach collection="po.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.noEntry != null and po.noEntry.size()>0">
                and no_entry in
                <foreach collection="po.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.noStopping != null and po.noStopping.size()>0">
                and no_stopping in
                <foreach collection="po.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.leftLaneLine != null and po.leftLaneLine.size()>0">
                and left_lane_line in
                <foreach collection="po.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.rightLaneLine != null and po.rightLaneLine.size()>0">
                and right_lane_line in
                <foreach collection="po.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.conductorMarking != null and po.conductorMarking.size()>0">
                and conductor_marking in
                <foreach collection="po.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.pedestrianCrossing != null and po.pedestrianCrossing.size()>0">
                and pedestrian_crossing in
                <foreach collection="po.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.trafficLight != null and po.trafficLight.size()>0">
                and traffic_light in
                <foreach collection="po.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.decelerationMarking != null and po.decelerationMarking.size()>0">
                and deceleration_marking in
                <foreach collection="po.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.pavementCondition != null and po.pavementCondition.size()>0">
                and pavement_condition in
                <foreach collection="po.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.naturalDisaster != null and po.naturalDisaster.size()>0">
                and natural_disaster in
                <foreach collection="po.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadSafetySigns != null and po.roadSafetySigns.size()>0">
                and road_safety_signs in
                <foreach collection="po.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.safetyWarningBoard != null and po.safetyWarningBoard.size()>0">
                and safety_warning_board in
                <foreach collection="po.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.trafficAccident != null and po.trafficAccident.size()>0">
                and traffic_accident in
                <foreach collection="po.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.patency != null and po.patency.size()>0">
                and patency in
                <foreach collection="po.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.specialVehicleYield != null and po.specialVehicleYield.size()>0">
                and special_vehicle_yield in
                <foreach collection="po.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.violation != null and po.violation.size()>0">
                and violation in
                <foreach collection="po.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.doubleFlashingCar != null and po.doubleFlashingCar.size()>0">
                and double_flashing_car in
                <foreach collection="po.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.selfBehavior != null and po.selfBehavior.size()>0">
                and
                <foreach collection="po.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="po.targetBehavior != null and po.targetBehavior.size()>0">
                and
                <foreach collection="po.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="po.ids != null and po.ids.length>0">
                and natural_id in
                <foreach collection="po.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.allSceneNames != null and po.allSceneNames.length>0">
                and natural_name in
                <foreach collection="po.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
        </where>
        union
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from simulation.scene_natural
        <where>
            <if test="poBq.naturalName != null and poBq.naturalName != ''">
                or natural_name like CONCAT('%',#{poBq.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="poBq.weather != null and poBq.weather.size()>0 ">
                or weather in
                <foreach collection="poBq.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.backlight != null and poBq.backlight.size()>0">
                or backlight in
                <foreach collection="poBq.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.lightChange != null and poBq.lightChange.size()>0">
                or light_change in
                <foreach collection="poBq.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadType != null and poBq.roadType.size()>0">
                or road_type in
                <foreach collection="poBq.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadMatrrial != null and poBq.roadMatrrial.size()>0">
                or road_matrrial in
                <foreach collection="poBq.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayNum != null and poBq.drivewayNum.size()>0">
                or driveway_num in
                <foreach collection="poBq.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayType != null and poBq.drivewayType.size()>0">
                or driveway_type in
                <foreach collection="poBq.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadFlatness != null and poBq.roadFlatness.size()>0">
                or road_flatness in
                <foreach collection="poBq.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadCurvature != null and poBq.roadCurvature.size()>0">
                or road_curvature in
                <foreach collection="poBq.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.ramp != null and poBq.ramp.size()>0">
                or ramp in
                <foreach collection="poBq.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.intersectionType != null and poBq.intersectionType.size()>0">
                or intersection_type in
                <foreach collection="poBq.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.planeIntersection != null and poBq.planeIntersection.size()>0">
                or plane_intersection in
                <foreach collection="poBq.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.bridge != null and poBq.bridge.size()>0">
                or bridge in
                <foreach collection="poBq.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.tunnel != null and poBq.tunnel.size()>0">
                or tunnel in
                <foreach collection="poBq.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.speedLimit != null and poBq.speedLimit.size()>0">
                or speed_limit in
                <foreach collection="poBq.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.minSpeedLimit != null and poBq.minSpeedLimit.size()>0">
                or min_speed_limit in
                <foreach collection="poBq.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noEntry != null and poBq.noEntry.size()>0">
                or no_entry in
                <foreach collection="poBq.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noStopping != null and poBq.noStopping.size()>0">
                or no_stopping in
                <foreach collection="poBq.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.leftLaneLine != null and poBq.leftLaneLine.size()>0">
                or left_lane_line in
                <foreach collection="poBq.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.rightLaneLine != null and poBq.rightLaneLine.size()>0">
                or right_lane_line in
                <foreach collection="poBq.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.conductorMarking != null and poBq.conductorMarking.size()>0">
                or conductor_marking in
                <foreach collection="poBq.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pedestrianCrossing != null and poBq.pedestrianCrossing.size()>0">
                or pedestrian_crossing in
                <foreach collection="poBq.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficLight != null and poBq.trafficLight.size()>0">
                or traffic_light in
                <foreach collection="poBq.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.decelerationMarking != null and poBq.decelerationMarking.size()>0">
                or deceleration_marking in
                <foreach collection="poBq.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pavementCondition != null and poBq.pavementCondition.size()>0">
                or pavement_condition in
                <foreach collection="poBq.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.naturalDisaster != null and poBq.naturalDisaster.size()>0">
                or natural_disaster in
                <foreach collection="poBq.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadSafetySigns != null and poBq.roadSafetySigns.size()>0">
                or road_safety_signs in
                <foreach collection="poBq.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.safetyWarningBoard != null and poBq.safetyWarningBoard.size()>0">
                or safety_warning_board in
                <foreach collection="poBq.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficAccident != null and poBq.trafficAccident.size()>0">
                or traffic_accident in
                <foreach collection="poBq.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.patency != null and poBq.patency.size()>0">
                or patency in
                <foreach collection="poBq.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.specialVehicleYield != null and poBq.specialVehicleYield.size()>0">
                or special_vehicle_yield in
                <foreach collection="poBq.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.violation != null and poBq.violation.size()>0">
                or violation in
                <foreach collection="poBq.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.doubleFlashingCar != null and poBq.doubleFlashingCar.size()>0">
                or double_flashing_car in
                <foreach collection="poBq.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.selfBehavior != null and poBq.selfBehavior.size()>0">
                or
                <foreach collection="poBq.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.targetBehavior != null and poBq.targetBehavior.size()>0">
                or
                <foreach collection="poBq.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.ids != null and poBq.ids.length>0">
                or natural_id in
                <foreach collection="poBq.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.allSceneNames != null and poBq.allSceneNames.length>0">
                or natural_name in
                <foreach collection="poBq.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
        </where>
        )a where
        a.is_deleted = '0'
        <if test="poBq.AllIds != null and poBq.AllIds.size()>0">
            or a.natural_id in
            <foreach collection="poBq.AllIds" item="item" index="index"
                     separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by a.modify_time desc

    </select>
    <select id="querySceneNaturalListByBq" parameterType="java.util.Map"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time from (
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from simulation.scene_natural
        <where>
            <if test="poBq.naturalName != null and poBq.naturalName != ''">
                natural_name like CONCAT('%',#{poBq.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="poBq.weather != null and poBq.weather.size()>0 ">
                or weather in
                <foreach collection="poBq.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.backlight != null and poBq.backlight.size()>0">
                or backlight in
                <foreach collection="poBq.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.lightChange != null and poBq.lightChange.size()>0">
                or light_change in
                <foreach collection="poBq.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadType != null and poBq.roadType.size()>0">
                or road_type in
                <foreach collection="poBq.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadMatrrial != null and poBq.roadMatrrial.size()>0">
                or road_matrrial in
                <foreach collection="poBq.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayNum != null and poBq.drivewayNum.size()>0">
                or driveway_num in
                <foreach collection="poBq.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayType != null and poBq.drivewayType.size()>0">
                or driveway_type in
                <foreach collection="poBq.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadFlatness != null and poBq.roadFlatness.size()>0">
                or road_flatness in
                <foreach collection="poBq.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadCurvature != null and poBq.roadCurvature.size()>0">
                or road_curvature in
                <foreach collection="poBq.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.ramp != null and poBq.ramp.size()>0">
                or ramp in
                <foreach collection="poBq.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.intersectionType != null and poBq.intersectionType.size()>0">
                or intersection_type in
                <foreach collection="poBq.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.planeIntersection != null and poBq.planeIntersection.size()>0">
                or plane_intersection in
                <foreach collection="poBq.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.bridge != null and poBq.bridge.size()>0">
                or bridge in
                <foreach collection="poBq.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.tunnel != null and poBq.tunnel.size()>0">
                or tunnel in
                <foreach collection="poBq.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.speedLimit != null and poBq.speedLimit.size()>0">
                or speed_limit in
                <foreach collection="poBq.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.minSpeedLimit != null and poBq.minSpeedLimit.size()>0">
                or min_speed_limit in
                <foreach collection="poBq.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noEntry != null and poBq.noEntry.size()>0">
                or no_entry in
                <foreach collection="poBq.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noStopping != null and poBq.noStopping.size()>0">
                or no_stopping in
                <foreach collection="poBq.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.leftLaneLine != null and poBq.leftLaneLine.size()>0">
                or left_lane_line in
                <foreach collection="poBq.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.rightLaneLine != null and poBq.rightLaneLine.size()>0">
                or right_lane_line in
                <foreach collection="poBq.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.conductorMarking != null and poBq.conductorMarking.size()>0">
                or conductor_marking in
                <foreach collection="poBq.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pedestrianCrossing != null and poBq.pedestrianCrossing.size()>0">
                or pedestrian_crossing in
                <foreach collection="poBq.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficLight != null and poBq.trafficLight.size()>0">
                or traffic_light in
                <foreach collection="poBq.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.decelerationMarking != null and poBq.decelerationMarking.size()>0">
                or deceleration_marking in
                <foreach collection="poBq.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pavementCondition != null and poBq.pavementCondition.size()>0">
                or pavement_condition in
                <foreach collection="poBq.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.naturalDisaster != null and poBq.naturalDisaster.size()>0">
                or natural_disaster in
                <foreach collection="poBq.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadSafetySigns != null and poBq.roadSafetySigns.size()>0">
                or road_safety_signs in
                <foreach collection="poBq.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.safetyWarningBoard != null and poBq.safetyWarningBoard.size()>0">
                or safety_warning_board in
                <foreach collection="poBq.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficAccident != null and poBq.trafficAccident.size()>0">
                or traffic_accident in
                <foreach collection="poBq.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.patency != null and poBq.patency.size()>0">
                or patency in
                <foreach collection="poBq.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.specialVehicleYield != null and poBq.specialVehicleYield.size()>0">
                or special_vehicle_yield in
                <foreach collection="poBq.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.violation != null and poBq.violation.size()>0">
                or violation in
                <foreach collection="poBq.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.doubleFlashingCar != null and poBq.doubleFlashingCar.size()>0">
                or double_flashing_car in
                <foreach collection="poBq.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.selfBehavior != null and poBq.selfBehavior.size()>0">
                or
                <foreach collection="poBq.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.targetBehavior != null and poBq.targetBehavior.size()>0">
                or
                <foreach collection="poBq.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.ids != null and poBq.ids.length>0">
                or natural_id in
                <foreach collection="poBq.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.allSceneNames != null and poBq.allSceneNames.length>0">
                or natural_name in
                <foreach collection="poBq.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            ) a
            where
            a.is_deleted = '0'
            <if test="po.AllIds != null and po.AllIds.size()>0">
                and a.natural_id in
                <foreach collection="po.AllIds" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            order by a.modify_time desc
        </where>
    </select>


    <update id="updateSceneNatural" parameterType="api.common.pojo.po.scene.SceneNaturalPO">
        update simulation.scene_natural
        set natural_name=#{naturalName},
            weather=#{weather},
            backlight=#{backlight},
            light_change=#{lightChange},
            road_type=#{roadType},
            road_matrrial=#{roadMatrrial},
            driveway_num=#{drivewayNum},
            driveway_type=#{drivewayType},
            road_flatness=#{roadFlatness},
            road_curvature=#{roadCurvature},
            ramp=#{ramp},
            intersection_type=#{intersectionType},
            plane_intersection=#{planeIntersection},
            bridge=#{bridge},
            tunnel=#{tunnel},
            speed_limit=#{speedLimit},
            min_speed_limit=#{minSpeedLimit},
            no_entry=#{noEntry},
            no_stopping=#{noStopping},
            left_lane_line=#{leftLaneLine},
            right_lane_line=#{rightLaneLine},
            conductor_marking=#{conductorMarking},
            pedestrian_crossing=#{pedestrianCrossing},
            traffic_light=#{trafficLight},
            deceleration_marking=#{decelerationMarking},
            pavement_condition=#{pavementCondition},
            natural_disaster=#{naturalDisaster},
            road_safety_signs=#{roadSafetySigns},
            safety_warning_board=#{safetyWarningBoard},
            traffic_accident=#{trafficAccident},
            patency=#{patency},
            special_vehicle_yield=#{specialVehicleYield},
            violation=#{violation},
            double_flashing_car=#{doubleFlashingCar},
            self_behavior=#{selfBehavior},
            target_behavior=#{targetBehavior},
            modify_user_id=#{modifyUserId},
            modify_time=#{modifyTime},
            video_address=#{videoAddress},
            osgb_address=#{osgbAddress},
            xodr_address=#{xodrAddress},
            xosc_address=#{xoscAddress},
            json_address=#{jsonAddress},
            max_time=#{maxTime}
        where natural_id = #{naturalId,jdbcType=VARCHAR}
    </update>

    <update id="updateSceneNaturalList" parameterType="java.util.List">
        <foreach collection="list" index="index" item="item" separator=";">
            update simulation.scene_natural
            set natural_name=#{item.naturalName},weather=#{item.weather},backlight=#{item.backlight},
            light_change=#{item.lightChange},road_type=#{item.roadType},road_matrrial=#{item.roadMatrrial},
            driveway_num=#{item.drivewayNum},driveway_type=#{item.drivewayType},road_flatness=#{item.roadFlatness},
            road_curvature=#{item.roadCurvature},ramp=#{item.ramp},intersection_type=#{item.intersectionType},
            plane_intersection=#{item.planeIntersection},bridge=#{item.bridge},tunnel=#{item.tunnel},
            speed_limit=#{item.speedLimit},min_speed_limit=#{item.minSpeedLimit},no_entry=#{item.noEntry},
            no_stopping=#{item.noStopping},left_lane_line=#{item.leftLaneLine},right_lane_line=#{item.rightLaneLine},
            conductor_marking=#{item.conductorMarking},pedestrian_crossing=#{item.pedestrianCrossing},traffic_light=#{item.trafficLight},
            deceleration_marking=#{item.decelerationMarking},pavement_condition=#{item.pavementCondition},natural_disaster=#{item.naturalDisaster},
            road_safety_signs=#{item.roadSafetySigns},safety_warning_board=#{item.safetyWarningBoard},traffic_accident=#{item.trafficAccident},
            patency=#{item.patency},special_vehicle_yield=#{item.specialVehicleYield},violation=#{item.violation},
            double_flashing_car=#{item.doubleFlashingCar},self_behavior=#{item.selfBehavior},target_behavior=#{item.targetBehavior},
            modify_user_id=#{item.modifyUserId},modify_time=#{item.modifyTime},video_address=#{item.videoAddress},
            osgb_address=#{item.osgbAddress},xodr_address=#{item.xodrAddress},xosc_address=#{item.xoscAddress},
            json_address=#{item.jsonAddress},max_time=#{item.maxTime}
            where natural_id = #{item.naturalId,jdbcType=VARCHAR}
        </foreach>
    </update>


    <select id="querySceneNaturalListByQx" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (select zr.* from( select s.scene_name
        FROM system_scene_package p
        JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
        JOIN system_scene_package_sublist s on p.id = s.scene_and_package
        where scene_type='1' and s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join scene_natural zr
        on qx.scene_name=zr.natural_name
        and zr.share='2' union select jtNew.* from scene_natural jtNew where jtNew.share='1' and is_deleted='0') dd
        <where>
            is_deleted = '0'
            <if test="naturalName != null and naturalName != ''">
                and natural_name like CONCAT('%',#{naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="weather != null and weather.size()>0 ">
                and weather in
                <foreach collection="weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="backlight != null and backlight.size()>0">
                and backlight in
                <foreach collection="backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="lightChange != null and lightChange.size()>0">
                and light_change in
                <foreach collection="lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadType != null and roadType.size()>0">
                and road_type in
                <foreach collection="roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadMatrrial != null and roadMatrrial.size()>0">
                and road_matrrial in
                <foreach collection="roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="drivewayNum != null and drivewayNum.size()>0">
                and driveway_num in
                <foreach collection="drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="drivewayType != null and drivewayType.size()>0">
                and driveway_type in
                <foreach collection="drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadFlatness != null and roadFlatness.size()>0">
                and road_flatness in
                <foreach collection="roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadCurvature != null and roadCurvature.size()>0">
                and road_curvature in
                <foreach collection="roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="ramp != null and ramp.size()>0">
                and ramp in
                <foreach collection="ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="intersectionType != null and intersectionType.size()>0">
                and intersection_type in
                <foreach collection="intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="planeIntersection != null and planeIntersection.size()>0">
                and plane_intersection in
                <foreach collection="planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="bridge != null and bridge.size()>0">
                and bridge in
                <foreach collection="bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="tunnel != null and tunnel.size()>0">
                and tunnel in
                <foreach collection="tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="speedLimit != null and speedLimit.size()>0">
                and speed_limit in
                <foreach collection="speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="minSpeedLimit != null and minSpeedLimit.size()>0">
                and min_speed_limit in
                <foreach collection="minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="noEntry != null and noEntry.size()>0">
                and no_entry in
                <foreach collection="noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="noStopping != null and noStopping.size()>0">
                and no_stopping in
                <foreach collection="noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="leftLaneLine != null and leftLaneLine.size()>0">
                and left_lane_line in
                <foreach collection="leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="rightLaneLine != null and rightLaneLine.size()>0">
                and right_lane_line in
                <foreach collection="rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="conductorMarking != null and conductorMarking.size()>0">
                and conductor_marking in
                <foreach collection="conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="pedestrianCrossing != null and pedestrianCrossing.size()>0">
                and pedestrian_crossing in
                <foreach collection="pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="trafficLight != null and trafficLight.size()>0">
                and traffic_light in
                <foreach collection="trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="decelerationMarking != null and decelerationMarking.size()>0">
                and deceleration_marking in
                <foreach collection="decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="pavementCondition != null and pavementCondition.size()>0">
                and pavement_condition in
                <foreach collection="pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="naturalDisaster != null and naturalDisaster.size()>0">
                and natural_disaster in
                <foreach collection="naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="roadSafetySigns != null and roadSafetySigns.size()>0">
                and road_safety_signs in
                <foreach collection="roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="safetyWarningBoard != null and safetyWarningBoard.size()>0">
                and safety_warning_board in
                <foreach collection="safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="trafficAccident != null and trafficAccident.size()>0">
                and traffic_accident in
                <foreach collection="trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="patency != null and patency.size()>0">
                and patency in
                <foreach collection="patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="specialVehicleYield != null and specialVehicleYield.size()>0">
                and special_vehicle_yield in
                <foreach collection="specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="violation != null and violation.size()>0">
                and violation in
                <foreach collection="violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="doubleFlashingCar != null and doubleFlashingCar.size()>0">
                and double_flashing_car in
                <foreach collection="doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="selfBehavior != null and selfBehavior.size()>0">
                and
                <foreach collection="selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="targetBehavior != null and targetBehavior.size()>0">
                and
                <foreach collection="targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="ids != null and ids.length>0">
                and natural_id in
                <foreach collection="ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="allSceneNames != null and allSceneNames.length>0">
                and natural_name in
                <foreach collection="allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="AllIds != null and AllIds.size()>0">
                and natural_id in
                <foreach collection="AllIds" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="share != null and share==0">
                and share =#{share}
            </if>
            <if test="share != null and share!= '' and share!=0">
                and share !='0'
            </if>
            <if test="needComplexity != null and needComplexity != ''">
                and dd.natural_id in (select scene_id from scene_complexity where is_deleted = '0'
                <if test="minComplexity != null and minComplexity != ''">
                    AND  complexity+0 >= #{minComplexity}
                </if>
                <if test="maxComplexity != null and maxComplexity != ''">
                    AND  complexity+0 &lt;=  #{maxComplexity}
                </if>
                <if test="complexityLevel != null and complexityLevel != ''">
                    AND complexity_level+0 >=  #{complexityLevel}
                </if>
                )
            </if>
            <if test="needRisk != null and needRisk != ''">
                and dd.natural_id in (select scene_id from scene_complexity where is_deleted = '0'
                <if test="minRisk != null and minRisk != ''">
                    AND risk+0 >= #{minRisk}
                </if>
                <if test="maxRisk != null and maxRisk != ''">
                    AND risk+0 &lt;=  #{maxRisk}
                </if>
                <if test="riskLevel != null and riskLevel != ''">
                    AND risk_level+0 >=  #{riskLevel}
                </if>
                )
            </if>
            order by create_time,natural_name desc
        </where>
    </select>

    <select id="querySceneNaturalListByBqAndXlkAndQx" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (select zr.* from( select s.scene_name
        FROM system_scene_package p
        JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
        JOIN system_scene_package_sublist s on p.id = s.scene_and_package
        where scene_type='1' and s.is_deleted = '0' and user_id=#{po.userId} group by s.scene_name)qx join scene_natural
        zr on qx.scene_name=zr.natural_name) dd
        <where>
            <if test="po.naturalName != null and po.naturalName != ''">
                natural_name like CONCAT('%',#{po.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="po.weather != null and po.weather.size()>0 ">
                and weather in
                <foreach collection="po.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.backlight != null and po.backlight.size()>0">
                and backlight in
                <foreach collection="po.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.lightChange != null and po.lightChange.size()>0">
                and light_change in
                <foreach collection="po.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadType != null and po.roadType.size()>0">
                and road_type in
                <foreach collection="po.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadMatrrial != null and po.roadMatrrial.size()>0">
                and road_matrrial in
                <foreach collection="po.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.drivewayNum != null and po.drivewayNum.size()>0">
                and driveway_num in
                <foreach collection="po.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.drivewayType != null and po.drivewayType.size()>0">
                and driveway_type in
                <foreach collection="po.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadFlatness != null and po.roadFlatness.size()>0">
                and road_flatness in
                <foreach collection="po.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadCurvature != null and po.roadCurvature.size()>0">
                and road_curvature in
                <foreach collection="po.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.ramp != null and po.ramp.size()>0">
                and ramp in
                <foreach collection="po.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.intersectionType != null and po.intersectionType.size()>0">
                and intersection_type in
                <foreach collection="po.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.planeIntersection != null and po.planeIntersection.size()>0">
                and plane_intersection in
                <foreach collection="po.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.bridge != null and po.bridge.size()>0">
                and bridge in
                <foreach collection="po.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.tunnel != null and po.tunnel.size()>0">
                and tunnel in
                <foreach collection="po.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.speedLimit != null and po.speedLimit.size()>0">
                and speed_limit in
                <foreach collection="po.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.minSpeedLimit != null and po.minSpeedLimit.size()>0">
                and min_speed_limit in
                <foreach collection="po.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.noEntry != null and po.noEntry.size()>0">
                and no_entry in
                <foreach collection="po.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.noStopping != null and po.noStopping.size()>0">
                and no_stopping in
                <foreach collection="po.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.leftLaneLine != null and po.leftLaneLine.size()>0">
                and left_lane_line in
                <foreach collection="po.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.rightLaneLine != null and po.rightLaneLine.size()>0">
                and right_lane_line in
                <foreach collection="po.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.conductorMarking != null and po.conductorMarking.size()>0">
                and conductor_marking in
                <foreach collection="po.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.pedestrianCrossing != null and po.pedestrianCrossing.size()>0">
                and pedestrian_crossing in
                <foreach collection="po.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.trafficLight != null and po.trafficLight.size()>0">
                and traffic_light in
                <foreach collection="po.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.decelerationMarking != null and po.decelerationMarking.size()>0">
                and deceleration_marking in
                <foreach collection="po.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.pavementCondition != null and po.pavementCondition.size()>0">
                and pavement_condition in
                <foreach collection="po.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.naturalDisaster != null and po.naturalDisaster.size()>0">
                and natural_disaster in
                <foreach collection="po.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.roadSafetySigns != null and po.roadSafetySigns.size()>0">
                and road_safety_signs in
                <foreach collection="po.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.safetyWarningBoard != null and po.safetyWarningBoard.size()>0">
                and safety_warning_board in
                <foreach collection="po.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.trafficAccident != null and po.trafficAccident.size()>0">
                and traffic_accident in
                <foreach collection="po.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.patency != null and po.patency.size()>0">
                and patency in
                <foreach collection="po.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.specialVehicleYield != null and po.specialVehicleYield.size()>0">
                and special_vehicle_yield in
                <foreach collection="po.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.violation != null and po.violation.size()>0">
                and violation in
                <foreach collection="po.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.doubleFlashingCar != null and po.doubleFlashingCar.size()>0">
                and double_flashing_car in
                <foreach collection="po.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.selfBehavior != null and po.selfBehavior.size()>0">
                and
                <foreach collection="po.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="po.targetBehavior != null and po.targetBehavior.size()>0">
                and
                <foreach collection="po.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="po.ids != null and po.ids.length>0">
                and natural_id in
                <foreach collection="po.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="po.allSceneNames != null and po.allSceneNames.length>0">
                and natural_name in
                <foreach collection="po.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
        </where>
        union
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (select zr.* from( select s.scene_name
        FROM system_scene_package p
        JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
        JOIN system_scene_package_sublist s on p.id = s.scene_and_package
        where scene_type='1' and s.is_deleted = '0' and user_id=#{poBq.userId} group by s.scene_name)qx join
        scene_natural zr on qx.scene_name=zr.natural_name) ee
        <where>
            <if test="poBq.naturalName != null and poBq.naturalName != ''">
                or natural_name like CONCAT('%',#{poBq.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="poBq.weather != null and poBq.weather.size()>0 ">
                or weather in
                <foreach collection="poBq.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.backlight != null and poBq.backlight.size()>0">
                or backlight in
                <foreach collection="poBq.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.lightChange != null and poBq.lightChange.size()>0">
                or light_change in
                <foreach collection="poBq.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadType != null and poBq.roadType.size()>0">
                or road_type in
                <foreach collection="poBq.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadMatrrial != null and poBq.roadMatrrial.size()>0">
                or road_matrrial in
                <foreach collection="poBq.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayNum != null and poBq.drivewayNum.size()>0">
                or driveway_num in
                <foreach collection="poBq.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayType != null and poBq.drivewayType.size()>0">
                or driveway_type in
                <foreach collection="poBq.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadFlatness != null and poBq.roadFlatness.size()>0">
                or road_flatness in
                <foreach collection="poBq.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadCurvature != null and poBq.roadCurvature.size()>0">
                or road_curvature in
                <foreach collection="poBq.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.ramp != null and poBq.ramp.size()>0">
                or ramp in
                <foreach collection="poBq.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.intersectionType != null and poBq.intersectionType.size()>0">
                or intersection_type in
                <foreach collection="poBq.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.planeIntersection != null and poBq.planeIntersection.size()>0">
                or plane_intersection in
                <foreach collection="poBq.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.bridge != null and poBq.bridge.size()>0">
                or bridge in
                <foreach collection="poBq.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.tunnel != null and poBq.tunnel.size()>0">
                or tunnel in
                <foreach collection="poBq.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.speedLimit != null and poBq.speedLimit.size()>0">
                or speed_limit in
                <foreach collection="poBq.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.minSpeedLimit != null and poBq.minSpeedLimit.size()>0">
                or min_speed_limit in
                <foreach collection="poBq.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noEntry != null and poBq.noEntry.size()>0">
                or no_entry in
                <foreach collection="poBq.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noStopping != null and poBq.noStopping.size()>0">
                or no_stopping in
                <foreach collection="poBq.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.leftLaneLine != null and poBq.leftLaneLine.size()>0">
                or left_lane_line in
                <foreach collection="poBq.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.rightLaneLine != null and poBq.rightLaneLine.size()>0">
                or right_lane_line in
                <foreach collection="poBq.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.conductorMarking != null and poBq.conductorMarking.size()>0">
                or conductor_marking in
                <foreach collection="poBq.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pedestrianCrossing != null and poBq.pedestrianCrossing.size()>0">
                or pedestrian_crossing in
                <foreach collection="poBq.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficLight != null and poBq.trafficLight.size()>0">
                or traffic_light in
                <foreach collection="poBq.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.decelerationMarking != null and poBq.decelerationMarking.size()>0">
                or deceleration_marking in
                <foreach collection="poBq.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pavementCondition != null and poBq.pavementCondition.size()>0">
                or pavement_condition in
                <foreach collection="poBq.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.naturalDisaster != null and poBq.naturalDisaster.size()>0">
                or natural_disaster in
                <foreach collection="poBq.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadSafetySigns != null and poBq.roadSafetySigns.size()>0">
                or road_safety_signs in
                <foreach collection="poBq.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.safetyWarningBoard != null and poBq.safetyWarningBoard.size()>0">
                or safety_warning_board in
                <foreach collection="poBq.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficAccident != null and poBq.trafficAccident.size()>0">
                or traffic_accident in
                <foreach collection="poBq.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.patency != null and poBq.patency.size()>0">
                or patency in
                <foreach collection="poBq.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.specialVehicleYield != null and poBq.specialVehicleYield.size()>0">
                or special_vehicle_yield in
                <foreach collection="poBq.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.violation != null and poBq.violation.size()>0">
                or violation in
                <foreach collection="poBq.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.doubleFlashingCar != null and poBq.doubleFlashingCar.size()>0">
                or double_flashing_car in
                <foreach collection="poBq.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.selfBehavior != null and poBq.selfBehavior.size()>0">
                or
                <foreach collection="poBq.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.targetBehavior != null and poBq.targetBehavior.size()>0">
                or
                <foreach collection="poBq.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.ids != null and poBq.ids.length>0">
                or natural_id in
                <foreach collection="poBq.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.allSceneNames != null and poBq.allSceneNames.length>0">
                or natural_name in
                <foreach collection="poBq.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
        </where>
        )a where
        a.is_deleted = '0'
        <if test="poBq.AllIds != null and poBq.AllIds.size()>0">
            and a.natural_id in
            <foreach collection="poBq.AllIds" item="item" index="index"
                     separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by a.modify_time desc

    </select>
    <select id="querySceneNaturalListByBqAndQx" parameterType="java.util.Map"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time from (
        select
        natural_id,natural_name,weather,backlight,light_change,road_type,
        road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
        ramp,intersection_type,plane_intersection,bridge,tunnel,speed_limit,
        min_speed_limit,no_entry,no_stopping,left_lane_line,right_lane_line,
        conductor_marking,pedestrian_crossing,traffic_light,deceleration_marking,
        pavement_condition,natural_disaster,road_safety_signs,safety_warning_board,
        traffic_accident,patency,special_vehicle_yield,violation,double_flashing_car,
        self_behavior,target_behavior,create_user_id,create_time,modify_user_id,
        modify_time,is_deleted,share,video_address,osgb_address,
        xodr_address,xosc_address,json_address,video_preview,max_time
        from (select zr.* from( select s.scene_name
        FROM system_scene_package p
        JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
        JOIN system_scene_package_sublist s on p.id = s.scene_and_package
        where scene_type='1' and s.is_deleted = '0' and user_id=#{poBq.userId} group by s.scene_name)qx join
        scene_natural zr on qx.scene_name=zr.natural_name) dd
        <where>
            <if test="poBq.naturalName != null and poBq.naturalName != ''">
                natural_name like CONCAT('%',#{poBq.naturalName,jdbcType=VARCHAR},'%')
            </if>
            <if test="poBq.weather != null and poBq.weather.size()>0 ">
                or weather in
                <foreach collection="poBq.weather" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.backlight != null and poBq.backlight.size()>0">
                or backlight in
                <foreach collection="poBq.backlight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.lightChange != null and poBq.lightChange.size()>0">
                or light_change in
                <foreach collection="poBq.lightChange" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadType != null and poBq.roadType.size()>0">
                or road_type in
                <foreach collection="poBq.roadType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadMatrrial != null and poBq.roadMatrrial.size()>0">
                or road_matrrial in
                <foreach collection="poBq.roadMatrrial" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayNum != null and poBq.drivewayNum.size()>0">
                or driveway_num in
                <foreach collection="poBq.drivewayNum" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.drivewayType != null and poBq.drivewayType.size()>0">
                or driveway_type in
                <foreach collection="poBq.drivewayType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadFlatness != null and poBq.roadFlatness.size()>0">
                or road_flatness in
                <foreach collection="poBq.roadFlatness" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadCurvature != null and poBq.roadCurvature.size()>0">
                or road_curvature in
                <foreach collection="poBq.roadCurvature" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.ramp != null and poBq.ramp.size()>0">
                or ramp in
                <foreach collection="poBq.ramp" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.intersectionType != null and poBq.intersectionType.size()>0">
                or intersection_type in
                <foreach collection="poBq.intersectionType" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.planeIntersection != null and poBq.planeIntersection.size()>0">
                or plane_intersection in
                <foreach collection="poBq.planeIntersection" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.bridge != null and poBq.bridge.size()>0">
                or bridge in
                <foreach collection="poBq.bridge" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.tunnel != null and poBq.tunnel.size()>0">
                or tunnel in
                <foreach collection="poBq.tunnel" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.speedLimit != null and poBq.speedLimit.size()>0">
                or speed_limit in
                <foreach collection="poBq.speedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.minSpeedLimit != null and poBq.minSpeedLimit.size()>0">
                or min_speed_limit in
                <foreach collection="poBq.minSpeedLimit" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noEntry != null and poBq.noEntry.size()>0">
                or no_entry in
                <foreach collection="poBq.noEntry" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.noStopping != null and poBq.noStopping.size()>0">
                or no_stopping in
                <foreach collection="poBq.noStopping" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.leftLaneLine != null and poBq.leftLaneLine.size()>0">
                or left_lane_line in
                <foreach collection="poBq.leftLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.rightLaneLine != null and poBq.rightLaneLine.size()>0">
                or right_lane_line in
                <foreach collection="poBq.rightLaneLine" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.conductorMarking != null and poBq.conductorMarking.size()>0">
                or conductor_marking in
                <foreach collection="poBq.conductorMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pedestrianCrossing != null and poBq.pedestrianCrossing.size()>0">
                or pedestrian_crossing in
                <foreach collection="poBq.pedestrianCrossing" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficLight != null and poBq.trafficLight.size()>0">
                or traffic_light in
                <foreach collection="poBq.trafficLight" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.decelerationMarking != null and poBq.decelerationMarking.size()>0">
                or deceleration_marking in
                <foreach collection="poBq.decelerationMarking" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.pavementCondition != null and poBq.pavementCondition.size()>0">
                or pavement_condition in
                <foreach collection="poBq.pavementCondition" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.naturalDisaster != null and poBq.naturalDisaster.size()>0">
                or natural_disaster in
                <foreach collection="poBq.naturalDisaster" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.roadSafetySigns != null and poBq.roadSafetySigns.size()>0">
                or road_safety_signs in
                <foreach collection="poBq.roadSafetySigns" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.safetyWarningBoard != null and poBq.safetyWarningBoard.size()>0">
                or safety_warning_board in
                <foreach collection="poBq.safetyWarningBoard" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.trafficAccident != null and poBq.trafficAccident.size()>0">
                or traffic_accident in
                <foreach collection="poBq.trafficAccident" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.patency != null and poBq.patency.size()>0">
                or patency in
                <foreach collection="poBq.patency" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.specialVehicleYield != null and poBq.specialVehicleYield.size()>0">
                or special_vehicle_yield in
                <foreach collection="poBq.specialVehicleYield" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.violation != null and poBq.violation.size()>0">
                or violation in
                <foreach collection="poBq.violation" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.doubleFlashingCar != null and poBq.doubleFlashingCar.size()>0">
                or double_flashing_car in
                <foreach collection="poBq.doubleFlashingCar" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.selfBehavior != null and poBq.selfBehavior.size()>0">
                or
                <foreach collection="poBq.selfBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    self_behavior like CONCAT('%,',#{item},',%')
                    or self_behavior like CONCAT('%,',#{item}) or
                    self_behavior like CONCAT(#{item},',%') or
                    self_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.targetBehavior != null and poBq.targetBehavior.size()>0">
                or
                <foreach collection="poBq.targetBehavior" item="item" index="index"
                         separator=" or " open="(" close=")">
                    target_behavior like CONCAT('%,',#{item},',%')
                    or target_behavior like CONCAT('%,',#{item}) or
                    target_behavior like CONCAT(#{item},',%') or
                    target_behavior=#{item}
                </foreach>

            </if>
            <if test="poBq.ids != null and poBq.ids.length>0">
                or natural_id in
                <foreach collection="poBq.ids" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="poBq.allSceneNames != null and poBq.allSceneNames.length>0">
                or natural_name in
                <foreach collection="poBq.allSceneNames" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            ) a
            where
            a.is_deleted = '0'
            <if test="po.AllIds != null and po.AllIds.size()>0">
                and a.natural_id in
                <foreach collection="po.AllIds" item="item" index="index"
                         separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            order by a.modify_time desc
        </where>
    </select>

    <select id="querySceneNaturalById" parameterType="java.lang.String"
            resultType="api.common.pojo.po.scene.SceneNaturalPO">
        select natural_id,
               natural_name,
               weather,
               backlight,
               light_change,
               road_type,
               road_matrrial,
               driveway_num,
               driveway_type,
               road_flatness,
               road_curvature,
               ramp,
               intersection_type,
               plane_intersection,
               bridge,
               tunnel,
               speed_limit,
               min_speed_limit,
               no_entry,
               no_stopping,
               left_lane_line,
               right_lane_line,
               conductor_marking,
               pedestrian_crossing,
               traffic_light,
               deceleration_marking,
               pavement_condition,
               natural_disaster,
               road_safety_signs,
               safety_warning_board,
               traffic_accident,
               patency,
               special_vehicle_yield,
               violation,
               double_flashing_car,
               self_behavior,
               target_behavior,
               create_user_id,
               create_time,
               modify_user_id,
               modify_time,
               is_deleted,
               share,
               video_preview,
               video_address,
               osgb_address,
               xodr_address,
               xosc_address,
               json_address,
               max_time
        from scene_natural
        where natural_id = #{id}
    </select>
    <select id="selectIdsByNames" resultType="java.lang.String">
        select natural_id
        from scene_natural
        where is_deleted = '0'
        and natural_name in
        <foreach item="item" collection="list" separator="," open="(" close=")">
            #{item}
        </foreach>
    </select>

</mapper>
