<?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.ruoyi.system.mapper.IllegalShipDataMapper">

    <resultMap type="IllegalShipData" id="IllegalShipDataResult">
        <result property="id" column="id"/>
        <result property="systemId" column="system_id"/>
        <result property="systemEsIndex" column="system_es_index"/>
        <result property="illegalType" column="illegal_type"/>
        <result property="mmsi" column="mmsi"/>
        <result property="shipName" column="ship_name"/>
        <result property="destination" column="destination"/>
        <result property="berthName" column="berth_name"/>
        <result property="shipRegionType" column="ship_region_type"/>
        <result property="orgName" column="org_name"/>
        <result property="dealResult" column="deal_result"/>
        <result property="fastResult" column="fast_result"/>
        <result property="uploadResult" column="upload_result"/>
        <result property="monitorPointName" column="monitor_point_name"/>
        <result property="so2Percent" column="so2_percent"/>
        <result property="no2Concentration" column="no2_concentration"/>
        <result property="so2Concentration" column="so2_concentration"/>
        <result property="co2Concentration" column="co2_concentration"/>
        <result property="rcgSoot" column="rcg_soot"/>
        <result property="sootImgUrl" column="soot_img_url"/>
        <result property="allImgUrl" column="all_img_url"/>
        <result property="illegalStatus" column="illegal_status"/>
        <result property="uploadFlag" column="upload_flag"/>
        <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="delFlag" column="del_flag"/>
    </resultMap>

    <sql id="selectIllegalShipDataVo">
        select id,
               system_id,
               system_es_index
                   illegal_type,
               mmsi,
               ship_name,
               destination,
               berth_name,
               ship_region_type,
               org_name,
               deal_result,
               fast_result,
               upload_result,
               monitor_point_name,
               so2_percent,
               no2_concentration,
               so2_concentration,
               co2_concentration,
               rcg_soot,
               soot_img_url,
               all_img_url,
               illegal_status,
               upload_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               del_flag
        from illegal_ship_data
    </sql>

    <select id="selectIllegalShipDataList" parameterType="IllegalShipData" resultMap="IllegalShipDataResult">
        <include refid="selectIllegalShipDataVo"/>
        <where>
            <if test="systemId != null and systemId != ''">and system_id = #{systemId}</if>
            <if test="systemEsIndex != null and systemEsIndex != ''">and system_es_index = #{systemEsIndex}</if>
            <if test="illegalType != null  and illegalType != ''">and illegal_type = #{illegalType}</if>
            <if test="mmsi != null  and mmsi != ''">and mmsi = #{mmsi}</if>
            <if test="shipName != null  and shipName != ''">and ship_name like concat('%', #{shipName}, '%')</if>
            <if test="destination != null  and destination != ''">and destination = #{destination}</if>
            <if test="berthName != null  and berthName != ''">and berth_name like concat('%', #{berthName}, '%')</if>
            <if test="shipRegionType != null  and shipRegionType != ''">and ship_region_type = #{shipRegionType}</if>
            <if test="orgName != null  and orgName != ''">and org_name like concat('%', #{orgName}, '%')</if>
            <if test="dealResult != null  and dealResult != ''">and deal_result = #{dealResult}</if>
            <if test="fastResult != null  and fastResult != ''">and fast_result = #{fastResult}</if>
            <if test="uploadResult != null  and uploadResult != ''">and upload_result = #{uploadResult}</if>
            <if test="monitorPointName != null  and monitorPointName != ''">and monitor_point_name like concat('%', #{monitorPointName}, '%')</if>
            <if test="so2Percent != null ">and so2_percent = #{so2Percent}</if>
            <if test="rcgSoot != null ">and rcg_soot = #{rcgSoot}</if>
            <if test="illegalStatus != null ">and illegal_status = #{illegalStatus}</if>
            <if test="uploadFlag != null ">and upload_flag = #{uploadFlag}</if>
        </where>
    </select>

    <select id="selectIllegalShipDataById" parameterType="Long" resultMap="IllegalShipDataResult">
        <include refid="selectIllegalShipDataVo"/>
        where id = #{id}
    </select>

    <insert id="insertIllegalShipData" parameterType="IllegalShipData">
        insert into illegal_ship_data
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="systemId != null">system_id,</if>
            <if test="systemEsIndex != null">system_es_index,</if>
            <if test="illegalType != null">illegal_type,</if>
            <if test="mmsi != null">mmsi,</if>
            <if test="shipName != null">ship_name,</if>
            <if test="destination != null">destination,</if>
            <if test="berthName != null">berth_name,</if>
            <if test="shipRegionType != null">ship_region_type,</if>
            <if test="orgName != null">org_name,</if>
            <if test="dealResult != null">deal_result,</if>
            <if test="fastResult != null">fast_result,</if>
            <if test="uploadResult != null">upload_result,</if>
            <if test="monitorPointName != null">monitor_point_name,</if>
            <if test="so2Percent != null">so2_percent,</if>
            <if test="no2Concentration != null">no2_concentration,</if>
            <if test="so2Concentration != null">so2_concentration,</if>
            <if test="co2Concentration != null">co2_concentration,</if>
            <if test="rcgSoot != null">rcg_soot,</if>
            <if test="sootImgUrl != null">soot_img_url,</if>
            <if test="allImgUrl != null">all_img_url,</if>
            <if test="illegalStatus != null">illegal_status,</if>
            <if test="uploadFlag != null">upload_flag,</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="delFlag != null">del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="systemId != null">#{systemId},</if>
            <if test="systemEsIndex != null">#{systemEsIndex},</if>
            <if test="illegalType != null">#{illegalType},</if>
            <if test="mmsi != null">#{mmsi},</if>
            <if test="shipName != null">#{shipName},</if>
            <if test="destination != null">#{destination},</if>
            <if test="berthName != null">#{berthName},</if>
            <if test="shipRegionType != null">#{shipRegionType},</if>
            <if test="orgName != null">#{orgName},</if>
            <if test="dealResult != null">#{dealResult},</if>
            <if test="fastResult != null">#{fastResult},</if>
            <if test="uploadResult != null">#{uploadResult},</if>
            <if test="monitorPointName != null">#{monitorPointName},</if>
            <if test="so2Percent != null">#{so2Percent},</if>
            <if test="no2Concentration != null">#{no2Concentration},</if>
            <if test="so2Concentration != null">#{so2Concentration},</if>
            <if test="co2Concentration != null">#{co2Concentration},</if>
            <if test="rcgSoot != null">#{rcgSoot},</if>
            <if test="sootImgUrl != null">#{sootImgUrl},</if>
            <if test="allImgUrl != null">#{allImgUrl},</if>
            <if test="illegalStatus != null">#{illegalStatus},</if>
            <if test="uploadFlag != null">#{uploadFlag},</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="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>

    <update id="updateIllegalShipData" parameterType="IllegalShipData">
        update illegal_ship_data
        <trim prefix="SET" suffixOverrides=",">
            <if test="illegalType != null">illegal_type = #{illegalType},</if>
            <if test="mmsi != null">mmsi = #{mmsi},</if>
            <if test="shipName != null">ship_name = #{shipName},</if>
            <if test="destination != null">destination = #{destination},</if>
            <if test="berthName != null">berth_name = #{berthName},</if>
            <if test="shipRegionType != null">ship_region_type = #{shipRegionType},</if>
            <if test="orgName != null">org_name = #{orgName},</if>
            <if test="dealResult != null">deal_result = #{dealResult},</if>
            <if test="fastResult != null">fast_result = #{fastResult},</if>
            <if test="uploadResult != null">upload_result = #{uploadResult},</if>
            <if test="monitorPointName != null">monitor_point_name = #{monitorPointName},</if>
            <if test="so2Percent != null">so2_percent = #{so2Percent},</if>
            <if test="no2Concentration != null">no2_concentration = #{no2Concentration},</if>
            <if test="so2Concentration != null">so2_concentration = #{so2Concentration},</if>
            <if test="co2Concentration != null">co2_concentration = #{co2Concentration},</if>
            <if test="rcgSoot != null">rcg_soot = #{rcgSoot},</if>
            <if test="sootImgUrl != null">soot_img_url = #{sootImgUrl},</if>
            <if test="allImgUrl != null">all_img_url = #{allImgUrl},</if>
            <if test="illegalStatus != null">illegal_status = #{illegalStatus},</if>
            <if test="uploadFlag != null">upload_flag = #{uploadFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIllegalShipDataById" parameterType="Long">
        delete
        from illegal_ship_data
        where id = #{id}
    </delete>

    <delete id="deleteIllegalShipDataByIds" parameterType="String">
        delete from illegal_ship_data where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>