<?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.base.biz.mapper.SceneBasisTargetMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.base.biz.model.entity.SceneBasisTarget">
        <id column="id_" property="id"/>
        <result column="target_code" property="targetCode"/>
        <result column="target_level" property="targetLevel"/>
        <result column="target_state" property="targetState"/>
        <result column="target_name" property="targetName"/>
        <result column="country_name" property="countryName"/>
        <result column="type" property="type"/>
        <result column="point_direction" property="pointDirection"/>
        <result column="point_count" property="pointCount"/>
        <result column="moving_status" property="movingStatus"/>
        <result column="moving_evg_speed" property="movingEvgSpeed"/>
        <result column="moving_max_speed" property="movingMaxSpeed"/>
        <result column="satellite_selected" property="satelliteSelected"/>
        <result column="station_selected" property="stationSelected"/>
        <result column="has_custom_feature" property="hasCustomFeature"/>
        <result column="has_electronic_feature" property="hasElectronicFeature"/>
        <result column="has_optics_feature" property="hasOpticsFeature"/>
        <result column="has_radar_feature" property="hasRadarFeature"/>
        <result column="has_motion_feature" property="hasMotionFeature"/>
        <result column="times" property="times"/>
        <result column="priority" property="priority"/>
        <result column="target_type" property="targetType"/>
        <result column="first_property" property="firstProperty"/>
        <result column="unit" property="unit"/>
        <result column="created_date" property="createdDate"/>
        <result column="created_by" property="createdBy"/>
        <result column="last_modified_by" property="lastModifiedBy"/>
        <result column="last_modified_date" property="lastModifiedDate"/>
        <result column="version_" property="version"/>
        <result column="status_" property="status"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        target_code
        , target_level, target_state, target_name, country_name, type, point_direction, point_count, moving_status, moving_evg_speed, moving_max_speed, satellite_selected, station_selected, has_custom_feature, has_electronic_feature, has_optics_feature, has_radar_feature, has_motion_feature, times, priority, target_type, first_property, unit, created_date, created_by, last_modified_by, last_modified_date, id
    </sql>

    <select id="getTargetByCode" parameterType="string" resultType="com.base.biz.model.entity.SceneBasisTarget">
        select *
        from scene_basis_target
        where target_code = #{code}
    </select>

    <select id="getTargetByCodes">
        select *
        from scene_basis_target
        where target_code in
        <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>

    <insert id="batch" parameterType="com.base.biz.model.entity.SceneBasisTarget">
        insert into scene_basis_target (<include refid="Base_Column_List"/>)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.targetCode},
            #{item.targetLevel},
            #{item.targetState},
            #{item.targetName},
            #{item.countryName},
            #{item.type},
            #{item.pointDirection},
            #{item.pointCount},
            #{item.movingStatus},
            #{item.movingEvgSpeed},
            #{item.movingMaxSpeed},
            #{item.satelliteSelected},
            #{item.stationSelected},
            #{item.hasCustomFeature},
            #{item.hasElectronicFeature},
            #{item.hasOpticsFeature},
            #{item.hasRadarFeature},
            #{item.hasMotionFeature},
            #{item.times},
            #{item.priority},
            #{item.targetType},
            #{item.firstProperty},
            #{item.unit},
            #{item.createdDate},
            #{item.createdBy},
            #{item.lastModifiedBy},
            #{item.lastModifiedDate},
            #{item.id}
            )
        </foreach>
    </insert>

</mapper>
