<?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.brilliance.isc.mda.dao.RemarkMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Remark">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="lotnum" column="lotnum" jdbcType="VARCHAR"/>
        <result property="note" column="note" jdbcType="VARCHAR"/>
        <result property="extkey" column="extkey" jdbcType="VARCHAR"/>
        <result property="cretim" column="cretim" jdbcType="TIMESTAMP"/>
        <result property="updtim" column="updtim" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,lotnum,note,extkey,cretim,updtim
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
        select
            <include refid="Base_Column_List" />
        from remark
        where inr = #{inr,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPrimaryKey">
        delete from remark
        where inr = #{inr,jdbcType=VARCHAR}
    </delete>

    <insert id="insert">
        insert into remark (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{lotnum,jdbcType=VARCHAR},
            #{note,jdbcType=VARCHAR},
            #{extkey,jdbcType=VARCHAR},
            #{cretim,jdbcType=TIMESTAMP},
            #{updtim,jdbcType=TIMESTAMP},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into remark
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="lotnum != null">lotnum,</if>
            <if test="note != null">note,</if>
            <if test="extkey != null">extkey,</if>
            <if test="cretim != null">cretim,</if>
            <if test="updtim != null">updtim,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="lotnum != null">#{lotnum,jdbcType=VARCHAR},</if>
            <if test="note != null">#{note,jdbcType=VARCHAR},</if>
            <if test="extkey != null">#{extkey,jdbcType=VARCHAR},</if>
            <if test="cretim != null">#{cretim,jdbcType=TIMESTAMP},</if>
            <if test="updtim != null">#{updtim,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update remark
        <set>
            <if test="lotnum != null">lotnum = #{lotnum,jdbcType=VARCHAR},</if>
            <if test="note != null">note = #{note,jdbcType=VARCHAR},</if>
            <if test="extkey != null">extkey = #{extkey,jdbcType=VARCHAR},</if>
            <if test="cretim != null">cretim = #{cretim,jdbcType=TIMESTAMP},</if>
            <if test="updtim != null">updtim = #{updtim,jdbcType=TIMESTAMP},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update remark
        <set>
            lotnum = #{lotnum,jdbcType=VARCHAR},
            note = #{note,jdbcType=VARCHAR},
            extkey = #{extkey,jdbcType=VARCHAR},
            cretim = #{cretim,jdbcType=TIMESTAMP},
            updtim = #{updtim,jdbcType=TIMESTAMP},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <select id="listFuzzyByRecord" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from remark
        <where>
            <if test="lotnum != null and lotnum != ''">
                and lotnum like concat('%',#{lotnum,jdbcType=VARCHAR},'%')
            </if>
            <if test="note != null and note != ''">
                and note = #{note,jdbcType=VARCHAR}
            </if>
            <if test="extkey != null and extkey != ''">
                and extkey = #{extkey,jdbcType=VARCHAR}
            </if>
            <if test="crebgn != null">
                and cretim &gt;= #{crebgn,jdbcType=DATE}
            </if>
            <if test="creend != null">
                and cretim &lt;= #{creend,jdbcType=DATE}
            </if>
            <if test="updbgn != null">
                and updtim &gt;= #{updbgn,jdbcType=DATE}
            </if>
            <if test="updend != null">
                and updtim &lt;= #{updend,jdbcType=DATE}
            </if>
        </where>
    </select>

    <select id="listByLotNum" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from remark
        where lotnum = #{lotnum,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByLotNum">
        delete from remark
        where lotnum = #{lotnum,jdbcType=VARCHAR}
    </delete>

</mapper>