<?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.agri.system.mapper.SysImeiAutoLogMapper">
    
    <resultMap type="SysImeiAutoLog" id="SysImeiAutoLogResult">
        <result property="id"    column="id"    />
        <result property="imei"    column="imei"    />
        <result property="rollFilm"    column="roll_film"    />
        <result property="monitorPeriod"    column="monitor_period"    />
        <result property="currentTemp"    column="current_temp"    />
        <result property="refTemp"    column="ref_temp"    />
        <result property="suitableTemp"    column="suitable_temp"    />
        <result property="fanStatus"    column="fan_status"    />
        <result property="isLast"    column="is_last"    />
        <result property="execCmd"    column="exec_cmd"    />
        <result property="logId"    column="log_id"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectSysImeiAutoLogVo">
        select id, imei, roll_film, monitor_period, current_temp, ref_temp, suitable_temp, fan_status, is_last, exec_cmd, log_id, remark, create_time, create_by, update_time, update_by from sys_imei_auto_log
    </sql>

    <select id="selectSysImeiAutoLogList" parameterType="SysImeiAutoLog" resultMap="SysImeiAutoLogResult">
        <include refid="selectSysImeiAutoLogVo"/>
        <where>  
            <if test="imei != null  and imei != ''"> and imei = #{imei}</if>
            <if test="rollFilm != null  and rollFilm != ''"> and roll_film = #{rollFilm}</if>
        </where>
    </select>
    
    <select id="selectSysImeiAutoLogById" parameterType="Long" resultMap="SysImeiAutoLogResult">
        <include refid="selectSysImeiAutoLogVo"/>
        where id = #{id}
    </select>

    <insert id="insertSysImeiAutoLog" parameterType="SysImeiAutoLog" useGeneratedKeys="true" keyProperty="id">
        insert into sys_imei_auto_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="imei != null and imei != ''">imei,</if>
            <if test="rollFilm != null and rollFilm != ''">roll_film,</if>
            <if test="monitorPeriod != null">monitor_period,</if>
            <if test="currentTemp != null">current_temp,</if>
            <if test="refTemp != null">ref_temp,</if>
            <if test="suitableTemp != null">suitable_temp,</if>
            <if test="fanStatus != null">fan_status,</if>
            <if test="isLast != null">is_last,</if>
            <if test="execCmd != null">exec_cmd,</if>
            <if test="logId != null">log_id,</if>
            <if test="remark != null">remark,</if>
    create_time,
    create_by,
    update_time,
    update_by,
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="imei != null and imei != ''">#{imei},</if>
            <if test="rollFilm != null and rollFilm != ''">#{rollFilm},</if>
            <if test="monitorPeriod != null">#{monitorPeriod},</if>
            <if test="currentTemp != null">#{currentTemp},</if>
            <if test="refTemp != null">#{refTemp},</if>
            <if test="suitableTemp != null">#{suitableTemp},</if>
            <if test="fanStatus != null">#{fanStatus},</if>
            <if test="isLast != null">#{isLast},</if>
            <if test="execCmd != null">#{execCmd},</if>
            <if test="logId != null">#{logId},</if>
            <if test="remark != null">#{remark},</if>
        #{createTime},
        #{createBy},
        #{updateTime},
        #{updateBy},
         </trim>
    </insert>

    <update id="updateSysImeiAutoLog" parameterType="SysImeiAutoLog">
        update sys_imei_auto_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="imei != null and imei != ''">imei = #{imei},</if>
            <if test="rollFilm != null and rollFilm != ''">roll_film = #{rollFilm},</if>
            <if test="monitorPeriod != null">monitor_period = #{monitorPeriod},</if>
            <if test="currentTemp != null">current_temp = #{currentTemp},</if>
            <if test="refTemp != null">ref_temp = #{refTemp},</if>
            <if test="suitableTemp != null">suitable_temp = #{suitableTemp},</if>
            <if test="fanStatus != null">fan_status = #{fanStatus},</if>
            <if test="isLast != null">is_last = #{isLast},</if>
            <if test="execCmd != null">exec_cmd = #{execCmd},</if>
            <if test="logId != null">log_id = #{logId},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysImeiAutoLogById" parameterType="Long">
        delete from sys_imei_auto_log where id = #{id}
    </delete>

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