<?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.DrawApplyUserfileMapper">
  <resultMap id="BaseResultMap" type="com.usoft.fin.grpc.dal.entity.DrawApplyUserfile">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="draw_code" jdbcType="VARCHAR" property="drawCode" />
    <result column="file_type_code" jdbcType="VARCHAR" property="fileTypeCode" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="number" jdbcType="SMALLINT" property="number" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="size" jdbcType="BIGINT" property="size" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, draw_code, file_type_code, url, number, name, size
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_draw_apply_userfile
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_draw_apply_userfile
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyUserfile">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply_userfile (code, draw_code, file_type_code, 
      url, number, name, 
      size)
    values (#{code,jdbcType=VARCHAR}, #{drawCode,jdbcType=VARCHAR}, #{fileTypeCode,jdbcType=VARCHAR}, 
      #{url,jdbcType=VARCHAR}, #{number,jdbcType=SMALLINT}, #{name,jdbcType=VARCHAR}, 
      #{size,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyUserfile">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_draw_apply_userfile
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="drawCode != null">
        draw_code,
      </if>
      <if test="fileTypeCode != null">
        file_type_code,
      </if>
      <if test="url != null">
        url,
      </if>
      <if test="number != null">
        number,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="size != null">
        size,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="drawCode != null">
        #{drawCode,jdbcType=VARCHAR},
      </if>
      <if test="fileTypeCode != null">
        #{fileTypeCode,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        #{number,jdbcType=SMALLINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="size != null">
        #{size,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyUserfile">
    update t_draw_apply_userfile
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="drawCode != null">
        draw_code = #{drawCode,jdbcType=VARCHAR},
      </if>
      <if test="fileTypeCode != null">
        file_type_code = #{fileTypeCode,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        number = #{number,jdbcType=SMALLINT},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="size != null">
        size = #{size,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.fin.grpc.dal.entity.DrawApplyUserfile">
    update t_draw_apply_userfile
    set code = #{code,jdbcType=VARCHAR},
      draw_code = #{drawCode,jdbcType=VARCHAR},
      file_type_code = #{fileTypeCode,jdbcType=VARCHAR},
      url = #{url,jdbcType=VARCHAR},
      number = #{number,jdbcType=SMALLINT},
      name = #{name,jdbcType=VARCHAR},
      size = #{size,jdbcType=BIGINT}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_draw_apply_userfile
    where code = #{code,jdbcType=VARCHAR}
  </select>
  <sql id="Table_Base_Column_List">
    t_draw_apply_userfile.id, t_draw_apply_userfile.code, t_draw_apply_userfile.draw_code, 
    t_draw_apply_userfile.file_type_code, t_draw_apply_userfile.url, t_draw_apply_userfile.number, 
    t_draw_apply_userfile.name, t_draw_apply_userfile.size
  </sql>
</mapper>