<?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.djhk.uav.uav.mapper.UavInformationMapper">
    
    <resultMap type="com.djhk.uav.uav.model.UavInformation" id="UavInformationResult">
        <result property="uavId"    column="uav_id"    />
        <result property="uavNum"    column="uav_num"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="uavName"    column="uav_name"    />
        <result property="detect"    column="detect"    />
        <result property="detectType"    column="detect_type"    />
        <result property="strikeBand"    column="strike_band"    />
        <result property="transmitPower"    column="transmit_power"    />
        <result property="antennaGain"    column="antenna_gain"    />
        <result property="antennaType"    column="antenna_type"    />
        <result property="operatingFrequency"    column="operating_frequency"    />
        <result property="blindDistance"    column="blind_distance"    />
        <result property="rcs"    column="rcs"    />
        <result property="pitchAngle"    column="pitch_angle"    />
        <result property="detectionRange"    column="detection_range"    />
        <result property="detectFalseAlarmRates"    column="detect_false_alarm_rates"    />
        <result property="targetingError"    column="targeting_error"    />
        <result property="trackUpdateTime"    column="track_update_time"    />
        <result property="detectionBands"    column="detection_bands"    />
        <result property="detectionDroneSorties"    column="detection_drone_sorties"    />
        <result property="targetingMethod"    column="targeting_method"    />
        <result property="crackingFunction"    column="cracking_function"    />
        <result property="imagingTechniques"    column="imaging_techniques"    />
        <result property="bandHz"    column="bandHz"    />
        <result property="useRange"    column="use_range"    />
        <result property="horizontalInterceptionAccuracy"    column="horizontal_interception_accuracy"    />
        <result property="verticalInterceptionAccuracy"    column="vertical_interception_accuracy"    />
        <result property="deptId"    column="dept_id"    />
        <result property="phyHit"    column="phy_hit"    />
    </resultMap>

    <sql id="selectUavInformationVo">
        select uav_id, uav_num, create_by, create_time, update_by, update_time, uav_name, detect_type, detect, strike_band, transmit_power, antenna_gain, antenna_type,
        operating_frequency, blind_distance, rcs, pitch_angle, detection_range, detect_false_alarm_rates, targeting_error, track_update_time, detection_bands,
        detection_drone_sorties, targeting_method, cracking_function, imaging_techniques, bandHz, use_range, horizontal_interception_accuracy,phy_hit,
        vertical_interception_accuracy, dept_id
        from uav_information
    </sql>

    <select id="selectUavInformationList" parameterType="com.djhk.uav.uav.model.UavInformation" resultMap="UavInformationResult">
        <include refid="selectUavInformationVo"/>
        <where>
            <if test="uavNum != null  and uavNum != ''"> and uav_num like concat('%', #{uavNum}, '%')</if>
            <if test="uavName != null  and uavName != ''"> and uav_name like concat('%', #{uavName}, '%')</if>
            <if test="detectType != null  and detectType != ''"> and detect_type like concat('%', #{detectType}, '%')</if>
            <if test="detect != null  and detect != ''"> and detect = #{detect}</if>
            <if test="strikeBand != null  and strikeBand != ''"> and strike_band = #{strikeBand}</if>
            <if test="transmitPower != null  and transmitPower != ''"> and transmit_power = #{transmitPower}</if>
            <if test="antennaGain != null  and antennaGain != ''"> and antenna_gain = #{antennaGain}</if>
            <if test="antennaType != null  and antennaType != ''"> and antenna_type = #{antennaType}</if>
            <if test="operatingFrequency != null  and operatingFrequency != ''"> and operating_frequency like concat('%', #{operatingFrequency}, '%')</if>
            <if test="blindDistance != null  and blindDistance != ''"> and blind_distance like concat('%', #{blindDistance}, '%')</if>
            <if test="rcs != null  and rcs != ''"> and rcs like concat('%', #{rcs}, '%')</if>
            <if test="pitchAngle != null  and pitchAngle != ''"> and pitch_angle like concat('%', #{pitchAngle}, '%')</if>
            <if test="detectionRange != null  and detectionRange != ''"> and detection_range like concat('%', #{detectionRange}, '%')</if>
            <if test="detectFalseAlarmRates != null  and detectFalseAlarmRates != ''"> and detect_false_alarm_rates like concat('%', #{detectFalseAlarmRates}, '%')</if>
            <if test="targetingError != null  and targetingError != ''"> and targeting_error like concat('%', #{targetingError}, '%')</if>
            <if test="trackUpdateTime != null  and trackUpdateTime != ''"> and track_update_time  =  #{trackUpdateTime}</if>
            <if test="detectionBands != null  and detectionBands != ''"> and detection_bands like concat('%', #{detectionBands}, '%')</if>
            <if test="detectionDroneSorties != null  and detectionDroneSorties != ''"> and detection_drone_sorties like concat('%', #{detectionDroneSorties}, '%')</if>
            <if test="targetingMethod != null  and targetingMethod != ''"> and targeting_method like concat('%', #{targetingMethod}, '%')</if>
            <if test="crackingFunction != null  and crackingFunction != ''"> and cracking_function like concat('%', #{crackingFunction}, '%')</if>
            <if test="imagingTechniques != null  and imagingTechniques != ''"> and imaging_techniques like concat('%', #{imagingTechniques}, '%')</if>
            <if test="useRange != null  and useRange != ''"> and use_range like concat('%', #{useRange}, '%')</if>
            <if test="bandHz != null  and bandHz != ''"> and bandHz like concat('%', #{bandHz}, '%')</if>
            <if test="horizontalInterceptionAccuracy != null  and horizontalInterceptionAccuracy != ''"> and horizontal_interception_accuracy = #{horizontalInterceptionAccuracy}</if>
            <if test="verticalInterceptionAccuracy != null  and verticalInterceptionAccuracy != ''"> and vertical_interception_accuracy = #{verticalInterceptionAccuracy}</if>
            <if test="phyHit != null  and phyHit != ''"> and phy_hit = #{phyHit}</if>
            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
        </where>
    </select>

    <select id="selectUavInformationByUavId" parameterType="Long" resultMap="UavInformationResult">
        <include refid="selectUavInformationVo"/>
        where uav_id = #{uavId}
    </select>


    <insert id="insertUavInformation" parameterType="com.djhk.uav.uav.model.UavInformation" useGeneratedKeys="true" keyProperty="uavId">
        insert into uav_information
        <trim prefix="(" suffix=")" suffixOverrides=",">
<!--            <if test="uavNum != null">uav_num,</if>-->
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
<!--            <if test="updateBy != null">update_by,</if>-->
<!--            <if test="updateTime != null">update_time,</if>-->
            <if test="uavName != null">uav_name,</if>
<!--            <if test="detect != null">detect,</if>-->
<!--            <if test="detectType != null">detect_type,</if>-->
            <if test="strikeBand != null">strike_band,</if>
            <if test="transmitPower != null">transmit_power,</if>
<!--            <if test="antennaGain != null">antenna_gain,</if>-->
<!--            <if test="antennaType != null">antenna_type,</if>-->
            <if test="operatingFrequency != null  and operatingFrequency != ''">operating_frequency,</if>
            <if test="blindDistance != null  and blindDistance != ''">blind_distance,</if>
            <if test="rcs != null  and rcs != ''">rcs,</if>
            <if test="pitchAngle != null  and pitchAngle != ''">pitch_angle,</if>
            <if test="detectionRange != null  and detectionRange != ''">detection_range,</if>
            <if test="detectFalseAlarmRates != null  and detectFalseAlarmRates != ''">detect_false_alarm_rates,</if>
            <if test="targetingError != null  and targetingError != ''">targeting_error,</if>
            <if test="trackUpdateTime != null  and trackUpdateTime != ''">track_update_time,</if>
            <if test="detectionBands != null  and detectionBands != ''">detection_bands,</if>
            <if test="detectionDroneSorties != null  and detectionDroneSorties != ''">detection_drone_sorties,</if>
            <if test="targetingMethod != null  and targetingMethod != ''">targeting_method,</if>
            <if test="crackingFunction != null  and crackingFunction != ''">cracking_function,</if>
            <if test="imagingTechniques != null  and imagingTechniques != ''">imaging_techniques,</if>
            <if test="bandHz != null  and bandHz != ''">bandHz,</if>
            <if test="useRange != null  and useRange != ''">use_range,</if>
            <if test="horizontalInterceptionAccuracy != null  and horizontalInterceptionAccuracy != ''">horizontal_interception_accuracy,</if>
            <if test="verticalInterceptionAccuracy != null  and verticalInterceptionAccuracy != ''">vertical_interception_accuracy,</if>
            <if test="deptId != null  and deptId != ''">dept_id,</if>
            <if test="phyHit != null  and phyHit != ''"> and phy_hit,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
<!--            <if test="uavNum != null">#{uavNum},</if>-->
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
<!--            <if test="updateBy != null">#{updateBy},</if>-->
<!--            <if test="updateTime != null">#{updateTime},</if>-->
            <if test="uavName != null">#{uavName},</if>
<!--            <if test="detect != null">#{detect},</if>-->
<!--            <if test="detectType != null">#{detectType},</if>-->
            <if test="strikeBand != null">#{strikeBand},</if>
            <if test="transmitPower != null">#{transmitPower},</if>
<!--            <if test="antennaGain != null">#{antennaGain},</if>-->
<!--            <if test="antennaType != null">#{antennaType},</if>-->
            <if test="operatingFrequency != null  and operatingFrequency != ''">#{operatingFrequency},</if>
            <if test="blindDistance != null  and blindDistance != ''"> #{blindDistance},</if>
            <if test="rcs != null  and rcs != ''">#{rcs},</if>
            <if test="pitchAngle != null  and pitchAngle != ''">#{pitchAngle},</if>
            <if test="detectionRange != null  and detectionRange != ''">#{detectionRange},</if>
            <if test="detectFalseAlarmRates != null  and detectFalseAlarmRates != ''">#{detectFalseAlarmRates},</if>
            <if test="targetingError != null  and targetingError != ''"> #{targetingError},</if>
            <if test="trackUpdateTime != null  and trackUpdateTime != ''">#{trackUpdateTime},</if>
            <if test="detectionBands != null  and detectionBands != ''">#{detectionBands},</if>
            <if test="detectionDroneSorties != null  and detectionDroneSorties != ''">#{detectionDroneSorties},</if>
            <if test="targetingMethod != null  and targetingMethod != ''">#{targetingMethod},</if>
            <if test="crackingFunction != null  and crackingFunction != ''">#{crackingFunction},</if>
            <if test="imagingTechniques != null  and imagingTechniques != ''">#{imagingTechniques},</if>
            <if test="bandHz != null  and bandHz != ''">#{bandHz},</if>
            <if test="useRange != null  and useRange != ''">#{useRange},</if>
            <if test="horizontalInterceptionAccuracy != null  and horizontalInterceptionAccuracy != ''">#{horizontalInterceptionAccuracy},</if>
            <if test="verticalInterceptionAccuracy != null  and verticalInterceptionAccuracy != ''">#{verticalInterceptionAccuracy},</if>
            <if test="deptId != null  and deptId != ''">#{deptId},</if>
            <if test="phyHit != null  and phyHit != ''">#{phyHit},</if>
         </trim>
    </insert>

    <update id="updateUavInformation" parameterType="com.djhk.uav.uav.model.UavInformation">
        update uav_information
        <trim prefix="SET" suffixOverrides=",">
<!--            <if test="uavNum != null">uav_num = #{uavNum},</if>-->
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="uavName != null">uav_name = #{uavName},</if>
<!--            <if test="detect != null">detect = #{detect},</if>-->
<!--            <if test="detectType != null">detect_type = #{detectType},</if>-->
<!--            <if test="detectType != null">detect_type = #{detectType},</if>-->
<!--            <if test="strikeBand != null">strike_band = #{strikeBand},</if>-->
            <if test="transmitPower != null">transmit_power = #{transmitPower},</if>
<!--            <if test="antennaGain != null">antenna_gain = #{antennaGain},</if>-->
<!--            <if test="antennaType != null">antenna_type = #{antennaType},</if>-->
            <if test="operatingFrequency != null">operating_frequency = #{operatingFrequency},</if>
            <if test="blindDistance != null"> blind_distance = #{blindDistance},</if>
            <if test="rcs != null">rcs = #{rcs},</if>
            <if test="pitchAngle != null">pitch_angle = #{pitchAngle},</if>
            <if test="detectionRange != null"> detection_range = #{detectionRange},</if>
            <if test="detectFalseAlarmRates != null">detect_false_alarm_rates = #{detectFalseAlarmRates},</if>
            <if test="targetingError != null"> targeting_error = #{targetingError},</if>
            <if test="trackUpdateTime != null">track_update_time = #{trackUpdateTime},</if>
            <if test="detectionBands != null">detection_bands = #{detectionBands},</if>
            <if test="detectionDroneSorties != null">detection_drone_sorties = #{detectionDroneSorties},</if>
            <if test="targetingMethod != null">targeting_method = #{targetingMethod},</if>
            <if test="crackingFunction != null">  cracking_function = #{crackingFunction},</if>
            <if test="imagingTechniques != null"> imaging_techniques = #{imagingTechniques},</if>
            <if test="bandHz != null">bandHz = #{bandHz},</if>
            <if test="useRange != null"> use_range = #{useRange},</if>
            <if test="horizontalInterceptionAccuracy != null">horizontal_interception_accuracy = #{horizontalInterceptionAccuracy},</if>
            <if test="verticalInterceptionAccuracy != null">vertical_interception_accuracy = #{verticalInterceptionAccuracy},</if>
            <if test="phyHit != null  and phyHit != ''"> and phy_hit = #{phyHit},</if>
        </trim>
        where uav_id = #{uavId}
    </update>

    <delete id="deleteUavInformationByUavId" parameterType="Long">
        delete from uav_information where uav_id = #{uavId}
    </delete>

    <delete id="deleteUavInformationByUavIds" parameterType="String">
        delete from uav_information where uav_id in
        <foreach item="modelId" collection="array" open="(" separator="," close=")">
            #{uavId}
        </foreach>
    </delete>
</mapper>
