<?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.DrawApplyOrderDetailMapper">
  <resultMap id="BaseResultMap" type="com.usoft.fin.grpc.dal.entity.DrawApplyOrderDetail">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="order_code" jdbcType="VARCHAR" property="orderCode" />
    <result column="specifications" jdbcType="VARCHAR" property="specifications" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="cmp_code" jdbcType="VARCHAR" property="cmpCode" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, order_code, specifications, name, cmp_code
  </sql>
  <sql id="Table_Base_Column_List">
    t_draw_apply_order_detail.id, t_draw_apply_order_detail.code, t_draw_apply_order_detail.order_code, 
    t_draw_apply_order_detail.specifications, t_draw_apply_order_detail.name, t_draw_apply_order_detail.cmp_code
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_draw_apply_order_detail
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_draw_apply_order_detail
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyOrderDetail">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply_order_detail (code, order_code, specifications, 
      name, cmp_code)
    values (#{code,jdbcType=VARCHAR}, #{orderCode,jdbcType=VARCHAR}, #{specifications,jdbcType=VARCHAR}, 
      #{name,jdbcType=VARCHAR}, #{cmpCode,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyOrderDetail">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply_order_detail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="orderCode != null">
        order_code,
      </if>
      <if test="specifications != null">
        specifications,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="cmpCode != null">
        cmp_code,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="orderCode != null">
        #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="specifications != null">
        #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="cmpCode != null">
        #{cmpCode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyOrderDetail">
    update t_draw_apply_order_detail
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="orderCode != null">
        order_code = #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="specifications != null">
        specifications = #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="cmpCode != null">
        cmp_code = #{cmpCode,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyOrderDetail">
    update t_draw_apply_order_detail
    set code = #{code,jdbcType=VARCHAR},
      order_code = #{orderCode,jdbcType=VARCHAR},
      specifications = #{specifications,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      cmp_code = #{cmpCode,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>