<?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.cool.store.mapper.fees.WalletPayInfoMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.fees.WalletPayInfoDO">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="shop_id" jdbcType="BIGINT" property="shopId" />
    <result column="pay_no" jdbcType="VARCHAR" property="payNo" />
    <result column="pay_user_name" jdbcType="VARCHAR" property="payUserName" />
    <result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
    <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
    <result column="pay_status" jdbcType="BIT" property="payStatus" />
    <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
    <result column="claim_status" jdbcType="BIT" property="claimStatus" />
    <result column="expense_types" jdbcType="VARCHAR" property="expenseTypes" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="batch_code" jdbcType="VARCHAR" property="batchCode" />
  </resultMap>

  <insert id="insertBatch" parameterType="java.util.List">
    INSERT INTO zxjp_fees_wallet_pay_info (shop_id, module, pay_no, pay_user_name, pay_amount, trade_id, pay_status, pay_time, claim_status, expense_types, remark, create_user_id, batch_code)
    VALUES
    <foreach collection="list" item="item" separator=",">
      (#{item.shopId}, #{item.module}, #{item.payNo}, #{item.payUserName}, #{item.payAmount}, #{item.tradeId}, #{item.payStatus}, #{item.payTime}, #{item.claimStatus}, #{item.expenseTypes}, #{item.remark}, #{item.createUserId}, #{item.batchCode})
    </foreach>
  </insert>

  <update id="updateByPayNo" parameterType="com.cool.store.entity.fees.WalletPayInfoDO">
    UPDATE zxjp_fees_wallet_pay_info
    <set>
      <if test="shopId != null">shop_id = #{shopId},</if>
      <if test="module != null">module = #{module},</if>
      <if test="payUserName != null">pay_user_name = #{payUserName},</if>
      <if test="payAmount != null">pay_amount = #{payAmount},</if>
      <if test="tradeId != null">trade_id = #{tradeId},</if>
      <if test="payStatus != null">pay_status = #{payStatus},</if>
      <if test="payTime != null">pay_time = #{payTime},</if>
      <if test="claimStatus != null">claim_status = #{claimStatus},</if>
      <if test="expenseTypes != null">expense_types = #{expenseTypes},</if>
      <if test="remark != null">remark = #{remark},</if>
      <if test="createUserId != null">create_user_id = #{createUserId},</if>
      create_time = create_time
    </set>
    WHERE pay_no = #{payNo}
  </update>

  <update id="updateBatchByPayNo">
    <foreach collection="list" item="item" separator=";">
      UPDATE zxjp_fees_wallet_pay_info
      <set>
        <if test="item.shopId != null">shop_id = #{item.shopId},</if>
        <if test="item.module != null">module = #{item.module},</if>
        <if test="item.payUserName != null">pay_user_name = #{item.payUserName},</if>
        <if test="item.payAmount != null">pay_amount = #{item.payAmount},</if>
        <if test="item.tradeId != null">trade_id = #{item.tradeId},</if>
        <if test="item.payStatus != null">pay_status = #{item.payStatus},</if>
        <if test="item.payTime != null">pay_time = #{item.payTime},</if>
        <if test="item.claimStatus != null">claim_status = #{item.claimStatus},</if>
        <if test="item.expenseTypes != null">expense_types = #{item.expenseTypes},</if>
        <if test="item.remark != null">remark = #{item.remark},</if>
        <if test="item.createUserId != null">create_user_id = #{item.createUserId},</if>
        create_time = create_time
      </set>
      WHERE pay_no = #{item.payNo}
    </foreach>
  </update>
</mapper>