<?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.goafanti.common.dao.AmbPaymentApplicationMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AmbPaymentApplication">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
    <result column="initiate_amb_id" jdbcType="BIGINT" property="initiateAmbId" />
    <result column="accept_amb_id" jdbcType="BIGINT" property="acceptAmbId" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="annex_url" jdbcType="VARCHAR" property="annexUrl" />
    <result column="process_status" jdbcType="INTEGER" property="processStatus" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, `type`, total_amount, initiate_amb_id, accept_amb_id, content, remarks, annex_url, 
    process_status, `status`, create_by, create_time, update_by, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from amb_payment_application
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from amb_payment_application
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbPaymentApplication" useGeneratedKeys="true">
    insert into amb_payment_application (`type`, total_amount, initiate_amb_id, 
      accept_amb_id, content, remarks, 
      annex_url, process_status, `status`, 
      create_by, create_time, update_by, 
      update_time)
    values (#{type,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, #{initiateAmbId,jdbcType=BIGINT}, 
      #{acceptAmbId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, 
      #{annexUrl,jdbcType=VARCHAR}, #{processStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, 
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbPaymentApplication" useGeneratedKeys="true">
    insert into amb_payment_application
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="type != null">
        `type`,
      </if>
      <if test="totalAmount != null">
        total_amount,
      </if>
      <if test="initiateAmbId != null">
        initiate_amb_id,
      </if>
      <if test="acceptAmbId != null">
        accept_amb_id,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="annexUrl != null">
        annex_url,
      </if>
      <if test="processStatus != null">
        process_status,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="totalAmount != null">
        #{totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="initiateAmbId != null">
        #{initiateAmbId,jdbcType=BIGINT},
      </if>
      <if test="acceptAmbId != null">
        #{acceptAmbId,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="annexUrl != null">
        #{annexUrl,jdbcType=VARCHAR},
      </if>
      <if test="processStatus != null">
        #{processStatus,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbPaymentApplication">
    update amb_payment_application
    <set>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="totalAmount != null">
        total_amount = #{totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="initiateAmbId != null">
        initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
      </if>
      <if test="acceptAmbId != null">
        accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="annexUrl != null">
        annex_url = #{annexUrl,jdbcType=VARCHAR},
      </if>
      <if test="processStatus != null">
        process_status = #{processStatus,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AmbPaymentApplication">
    update amb_payment_application
    set `type` = #{type,jdbcType=INTEGER},
      total_amount = #{totalAmount,jdbcType=DECIMAL},
      initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
      accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
      content = #{content,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      annex_url = #{annexUrl,jdbcType=VARCHAR},
      process_status = #{processStatus,jdbcType=INTEGER},
      `status` = #{status,jdbcType=INTEGER},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_by = #{updateBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>