<?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.usoft.fin.grpc.dal.mapper.DrawApplyMapper">
  <resultMap id="BaseResultMap" type="com.usoft.fin.grpc.dal.entity.DrawApply">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="credit_code" jdbcType="VARCHAR" property="creditCode" />
    <result column="credit_apply_code" jdbcType="VARCHAR" property="creditApplyCode" />
    <result column="product_code" jdbcType="VARCHAR" property="productCode" />
    <result column="enuu" jdbcType="INTEGER" property="enuu" />
    <result column="start_date" jdbcType="VARCHAR" property="startDate" />
    <result column="submit_date" jdbcType="VARCHAR" property="submitDate" />
    <result column="audit_date" jdbcType="VARCHAR" property="auditDate" />
    <result column="end_date" jdbcType="VARCHAR" property="endDate" />
    <result column="draw_amount" jdbcType="INTEGER" property="drawAmount" />
    <result column="transfer_amount" jdbcType="DECIMAL" property="transferAmount" />
    <result column="month_rate" jdbcType="DECIMAL" property="monthRate" />
    <result column="maturity" jdbcType="SMALLINT" property="maturity" />
    <result column="audit_status" jdbcType="SMALLINT" property="auditStatus" />
    <result column="draw_status" jdbcType="SMALLINT" property="drawStatus" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, credit_code, credit_apply_code, product_code, enuu, start_date, submit_date, 
    audit_date, end_date, draw_amount, transfer_amount, month_rate, maturity, audit_status, 
    draw_status
  </sql>
  <sql id="Table_Base_Column_List">
    t_draw_apply.id, t_draw_apply.code, t_draw_apply.credit_code, t_draw_apply.credit_apply_code, 
    t_draw_apply.product_code, t_draw_apply.enuu, t_draw_apply.start_date, t_draw_apply.submit_date, 
    t_draw_apply.audit_date, t_draw_apply.end_date, t_draw_apply.draw_amount, t_draw_apply.transfer_amount, 
    t_draw_apply.month_rate, t_draw_apply.maturity, t_draw_apply.audit_status, t_draw_apply.draw_status
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_draw_apply
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_draw_apply
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.fin.grpc.dal.entity.DrawApply">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply (code, credit_code, credit_apply_code, 
      product_code, enuu, start_date, 
      submit_date, audit_date, end_date, 
      draw_amount, transfer_amount, month_rate, 
      maturity, audit_status, draw_status
      )
    values (#{code,jdbcType=VARCHAR}, #{creditCode,jdbcType=VARCHAR}, #{creditApplyCode,jdbcType=VARCHAR}, 
      #{productCode,jdbcType=VARCHAR}, #{enuu,jdbcType=INTEGER}, #{startDate,jdbcType=VARCHAR}, 
      #{submitDate,jdbcType=VARCHAR}, #{auditDate,jdbcType=VARCHAR}, #{endDate,jdbcType=VARCHAR}, 
      #{drawAmount,jdbcType=INTEGER}, #{transferAmount,jdbcType=DECIMAL}, #{monthRate,jdbcType=DECIMAL}, 
      #{maturity,jdbcType=SMALLINT}, #{auditStatus,jdbcType=SMALLINT}, #{drawStatus,jdbcType=SMALLINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApply">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="creditCode != null">
        credit_code,
      </if>
      <if test="creditApplyCode != null">
        credit_apply_code,
      </if>
      <if test="productCode != null">
        product_code,
      </if>
      <if test="enuu != null">
        enuu,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="submitDate != null">
        submit_date,
      </if>
      <if test="auditDate != null">
        audit_date,
      </if>
      <if test="endDate != null">
        end_date,
      </if>
      <if test="drawAmount != null">
        draw_amount,
      </if>
      <if test="transferAmount != null">
        transfer_amount,
      </if>
      <if test="monthRate != null">
        month_rate,
      </if>
      <if test="maturity != null">
        maturity,
      </if>
      <if test="auditStatus != null">
        audit_status,
      </if>
      <if test="drawStatus != null">
        draw_status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="creditCode != null">
        #{creditCode,jdbcType=VARCHAR},
      </if>
      <if test="creditApplyCode != null">
        #{creditApplyCode,jdbcType=VARCHAR},
      </if>
      <if test="productCode != null">
        #{productCode,jdbcType=VARCHAR},
      </if>
      <if test="enuu != null">
        #{enuu,jdbcType=INTEGER},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=VARCHAR},
      </if>
      <if test="submitDate != null">
        #{submitDate,jdbcType=VARCHAR},
      </if>
      <if test="auditDate != null">
        #{auditDate,jdbcType=VARCHAR},
      </if>
      <if test="endDate != null">
        #{endDate,jdbcType=VARCHAR},
      </if>
      <if test="drawAmount != null">
        #{drawAmount,jdbcType=INTEGER},
      </if>
      <if test="transferAmount != null">
        #{transferAmount,jdbcType=DECIMAL},
      </if>
      <if test="monthRate != null">
        #{monthRate,jdbcType=DECIMAL},
      </if>
      <if test="maturity != null">
        #{maturity,jdbcType=SMALLINT},
      </if>
      <if test="auditStatus != null">
        #{auditStatus,jdbcType=SMALLINT},
      </if>
      <if test="drawStatus != null">
        #{drawStatus,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApply">
    update t_draw_apply
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="creditCode != null">
        credit_code = #{creditCode,jdbcType=VARCHAR},
      </if>
      <if test="creditApplyCode != null">
        credit_apply_code = #{creditApplyCode,jdbcType=VARCHAR},
      </if>
      <if test="productCode != null">
        product_code = #{productCode,jdbcType=VARCHAR},
      </if>
      <if test="enuu != null">
        enuu = #{enuu,jdbcType=INTEGER},
      </if>
      <if test="startDate != null">
        start_date = #{startDate,jdbcType=VARCHAR},
      </if>
      <if test="submitDate != null">
        submit_date = #{submitDate,jdbcType=VARCHAR},
      </if>
      <if test="auditDate != null">
        audit_date = #{auditDate,jdbcType=VARCHAR},
      </if>
      <if test="endDate != null">
        end_date = #{endDate,jdbcType=VARCHAR},
      </if>
      <if test="drawAmount != null">
        draw_amount = #{drawAmount,jdbcType=INTEGER},
      </if>
      <if test="transferAmount != null">
        transfer_amount = #{transferAmount,jdbcType=DECIMAL},
      </if>
      <if test="monthRate != null">
        month_rate = #{monthRate,jdbcType=DECIMAL},
      </if>
      <if test="maturity != null">
        maturity = #{maturity,jdbcType=SMALLINT},
      </if>
      <if test="auditStatus != null">
        audit_status = #{auditStatus,jdbcType=SMALLINT},
      </if>
      <if test="drawStatus != null">
        draw_status = #{drawStatus,jdbcType=SMALLINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.fin.grpc.dal.entity.DrawApply">
    update t_draw_apply
    set code = #{code,jdbcType=VARCHAR},
      credit_code = #{creditCode,jdbcType=VARCHAR},
      credit_apply_code = #{creditApplyCode,jdbcType=VARCHAR},
      product_code = #{productCode,jdbcType=VARCHAR},
      enuu = #{enuu,jdbcType=INTEGER},
      start_date = #{startDate,jdbcType=VARCHAR},
      submit_date = #{submitDate,jdbcType=VARCHAR},
      audit_date = #{auditDate,jdbcType=VARCHAR},
      end_date = #{endDate,jdbcType=VARCHAR},
      draw_amount = #{drawAmount,jdbcType=INTEGER},
      transfer_amount = #{transferAmount,jdbcType=DECIMAL},
      month_rate = #{monthRate,jdbcType=DECIMAL},
      maturity = #{maturity,jdbcType=SMALLINT},
      audit_status = #{auditStatus,jdbcType=SMALLINT},
      draw_status = #{drawStatus,jdbcType=SMALLINT}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>