<?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.xhpc.activity.mapper.XhpcClearingReceiptMapper">
  <resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcClearingReceiptDomain">
    <id column="clearing_receipt_id" jdbcType="BIGINT" property="clearingReceiptId" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="clearing_checkout_ids" jdbcType="VARCHAR" property="clearingCheckoutIds" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
  </resultMap>
  <sql id="Base_Column_List">
    clearing_receipt_id, `type`, `name`, url, clearing_checkout_ids, create_time, create_by
  </sql>


  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from xhpc_clearing_receipt
    where clearing_receipt_id = #{clearingReceiptId,jdbcType=BIGINT}
  </select>



  <insert id="insert" keyColumn="clearing_receipt_id" keyProperty="clearingReceiptId" parameterType="com.xhpc.activity.domain.XhpcClearingReceiptDomain" useGeneratedKeys="true">
    insert into xhpc_clearing_receipt (`type`, `name`, url, 
      clearing_checkout_ids, create_time, create_by
      )
    values (#{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
      #{clearingCheckoutIds,jdbcType=BIGINT}, sysdate(), #{createBy,jdbcType=VARCHAR}
      )
  </insert>


  <insert id="insretBatch">
    insert into xhpc_clearing_receipt (`type`, `name`, url,
                                       clearing_checkout_ids, create_time, create_by
    ) values
    <foreach collection="domainList" item="domain" separator=",">
      (#{domain.type,jdbcType=INTEGER}, #{domain.name,jdbcType=VARCHAR}, #{domain.url,jdbcType=VARCHAR},
      #{domain.clearingCheckoutIds,jdbcType=BIGINT}, sysdate(), #{domain.createBy,jdbcType=VARCHAR}
      )
    </foreach>


  </insert>


</mapper>