<?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.yd.dal.mapper.customer.AclCustomerFortuneWithdrawMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
    <!--@mbg.generated-->
    <!--@Table ag_acl_customer_fortune_withdraw-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="customer_id" jdbcType="BIGINT" property="customerId" />
    <result column="lottery_draws_id" jdbcType="BIGINT" property="lotteryDrawsId" />
    <result column="withdraw_before_amount" jdbcType="DECIMAL" property="withdrawBeforeAmount" />
    <result column="withdraw_amount" jdbcType="DECIMAL" property="withdrawAmount" />
    <result column="withdraw_after_amount" jdbcType="DECIMAL" property="withdrawAfterAmount" />
    <result column="is_paid" jdbcType="INTEGER" property="isPaid" />
    <result column="paid_date" jdbcType="TIMESTAMP" property="paidDate" />
    <result column="paid_amount" jdbcType="DECIMAL" property="paidAmount" />
    <result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" />
    <result column="paid_method" jdbcType="INTEGER" property="paidMethod" />
    <result column="requestor_name" jdbcType="VARCHAR" property="requestorName" />
    <result column="requestor_id_type_id" jdbcType="BIGINT" property="requestorIdTypeId" />
    <result column="requestor_id" jdbcType="VARCHAR" property="requestorId" />
    <result column="requestor_birthdate" jdbcType="DATE" property="requestorBirthdate" />
    <result column="requestor_gender" jdbcType="INTEGER" property="requestorGender" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="wechat_id" jdbcType="VARCHAR" property="wechatId" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, customer_id, lottery_draws_id, withdraw_before_amount, withdraw_amount, withdraw_after_amount,
    is_paid, paid_date, paid_amount, tax_amount, paid_method, requestor_name, requestor_id_type_id,
    requestor_id, requestor_birthdate, requestor_gender, `status`, wechat_id, created_at,
    created_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ag_acl_customer_fortune_withdraw
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ag_acl_customer_fortune_withdraw
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer_fortune_withdraw (customer_id, lottery_draws_id, withdraw_before_amount, 
      withdraw_amount, withdraw_after_amount, is_paid, 
      paid_date, paid_amount, tax_amount, 
      paid_method, requestor_name, requestor_id_type_id, 
      requestor_id, requestor_birthdate, requestor_gender, 
      `status`, wechat_id, created_at, 
      created_by)
    values (#{customerId,jdbcType=BIGINT}, #{lotteryDrawsId,jdbcType=BIGINT}, #{withdrawBeforeAmount,jdbcType=DECIMAL}, 
      #{withdrawAmount,jdbcType=DECIMAL}, #{withdrawAfterAmount,jdbcType=DECIMAL}, #{isPaid,jdbcType=INTEGER}, 
      #{paidDate,jdbcType=TIMESTAMP}, #{paidAmount,jdbcType=DECIMAL}, #{taxAmount,jdbcType=DECIMAL}, 
      #{paidMethod,jdbcType=INTEGER}, #{requestorName,jdbcType=VARCHAR}, #{requestorIdTypeId,jdbcType=BIGINT}, 
      #{requestorId,jdbcType=VARCHAR}, #{requestorBirthdate,jdbcType=DATE}, #{requestorGender,jdbcType=INTEGER}, 
      #{status,jdbcType=INTEGER}, #{wechatId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer_fortune_withdraw
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="lotteryDrawsId != null">
        lottery_draws_id,
      </if>
      <if test="withdrawBeforeAmount != null">
        withdraw_before_amount,
      </if>
      <if test="withdrawAmount != null">
        withdraw_amount,
      </if>
      <if test="withdrawAfterAmount != null">
        withdraw_after_amount,
      </if>
      <if test="isPaid != null">
        is_paid,
      </if>
      <if test="paidDate != null">
        paid_date,
      </if>
      <if test="paidAmount != null">
        paid_amount,
      </if>
      <if test="taxAmount != null">
        tax_amount,
      </if>
      <if test="paidMethod != null">
        paid_method,
      </if>
      <if test="requestorName != null">
        requestor_name,
      </if>
      <if test="requestorIdTypeId != null">
        requestor_id_type_id,
      </if>
      <if test="requestorId != null">
        requestor_id,
      </if>
      <if test="requestorBirthdate != null">
        requestor_birthdate,
      </if>
      <if test="requestorGender != null">
        requestor_gender,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="wechatId != null">
        wechat_id,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="customerId != null">
        #{customerId,jdbcType=BIGINT},
      </if>
      <if test="lotteryDrawsId != null">
        #{lotteryDrawsId,jdbcType=BIGINT},
      </if>
      <if test="withdrawBeforeAmount != null">
        #{withdrawBeforeAmount,jdbcType=DECIMAL},
      </if>
      <if test="withdrawAmount != null">
        #{withdrawAmount,jdbcType=DECIMAL},
      </if>
      <if test="withdrawAfterAmount != null">
        #{withdrawAfterAmount,jdbcType=DECIMAL},
      </if>
      <if test="isPaid != null">
        #{isPaid,jdbcType=INTEGER},
      </if>
      <if test="paidDate != null">
        #{paidDate,jdbcType=TIMESTAMP},
      </if>
      <if test="paidAmount != null">
        #{paidAmount,jdbcType=DECIMAL},
      </if>
      <if test="taxAmount != null">
        #{taxAmount,jdbcType=DECIMAL},
      </if>
      <if test="paidMethod != null">
        #{paidMethod,jdbcType=INTEGER},
      </if>
      <if test="requestorName != null">
        #{requestorName,jdbcType=VARCHAR},
      </if>
      <if test="requestorIdTypeId != null">
        #{requestorIdTypeId,jdbcType=BIGINT},
      </if>
      <if test="requestorId != null">
        #{requestorId,jdbcType=VARCHAR},
      </if>
      <if test="requestorBirthdate != null">
        #{requestorBirthdate,jdbcType=DATE},
      </if>
      <if test="requestorGender != null">
        #{requestorGender,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="wechatId != null">
        #{wechatId,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
    <!--@mbg.generated-->
    update ag_acl_customer_fortune_withdraw
    <set>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=BIGINT},
      </if>
      <if test="lotteryDrawsId != null">
        lottery_draws_id = #{lotteryDrawsId,jdbcType=BIGINT},
      </if>
      <if test="withdrawBeforeAmount != null">
        withdraw_before_amount = #{withdrawBeforeAmount,jdbcType=DECIMAL},
      </if>
      <if test="withdrawAmount != null">
        withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
      </if>
      <if test="withdrawAfterAmount != null">
        withdraw_after_amount = #{withdrawAfterAmount,jdbcType=DECIMAL},
      </if>
      <if test="isPaid != null">
        is_paid = #{isPaid,jdbcType=INTEGER},
      </if>
      <if test="paidDate != null">
        paid_date = #{paidDate,jdbcType=TIMESTAMP},
      </if>
      <if test="paidAmount != null">
        paid_amount = #{paidAmount,jdbcType=DECIMAL},
      </if>
      <if test="taxAmount != null">
        tax_amount = #{taxAmount,jdbcType=DECIMAL},
      </if>
      <if test="paidMethod != null">
        paid_method = #{paidMethod,jdbcType=INTEGER},
      </if>
      <if test="requestorName != null">
        requestor_name = #{requestorName,jdbcType=VARCHAR},
      </if>
      <if test="requestorIdTypeId != null">
        requestor_id_type_id = #{requestorIdTypeId,jdbcType=BIGINT},
      </if>
      <if test="requestorId != null">
        requestor_id = #{requestorId,jdbcType=VARCHAR},
      </if>
      <if test="requestorBirthdate != null">
        requestor_birthdate = #{requestorBirthdate,jdbcType=DATE},
      </if>
      <if test="requestorGender != null">
        requestor_gender = #{requestorGender,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="wechatId != null">
        wechat_id = #{wechatId,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
    <!--@mbg.generated-->
    update ag_acl_customer_fortune_withdraw
    set customer_id = #{customerId,jdbcType=BIGINT},
      lottery_draws_id = #{lotteryDrawsId,jdbcType=BIGINT},
      withdraw_before_amount = #{withdrawBeforeAmount,jdbcType=DECIMAL},
      withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
      withdraw_after_amount = #{withdrawAfterAmount,jdbcType=DECIMAL},
      is_paid = #{isPaid,jdbcType=INTEGER},
      paid_date = #{paidDate,jdbcType=TIMESTAMP},
      paid_amount = #{paidAmount,jdbcType=DECIMAL},
      tax_amount = #{taxAmount,jdbcType=DECIMAL},
      paid_method = #{paidMethod,jdbcType=INTEGER},
      requestor_name = #{requestorName,jdbcType=VARCHAR},
      requestor_id_type_id = #{requestorIdTypeId,jdbcType=BIGINT},
      requestor_id = #{requestorId,jdbcType=VARCHAR},
      requestor_birthdate = #{requestorBirthdate,jdbcType=DATE},
      requestor_gender = #{requestorGender,jdbcType=INTEGER},
      `status` = #{status,jdbcType=INTEGER},
      wechat_id = #{wechatId,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_customer_fortune_withdraw
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="customer_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="lottery_draws_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.lotteryDrawsId,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="withdraw_before_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawBeforeAmount,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="withdraw_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="withdraw_after_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAfterAmount,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="is_paid = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.isPaid,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="paid_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.paidDate,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="paid_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.paidAmount,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="tax_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="paid_method = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="requestor_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.requestorName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="requestor_id_type_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.requestorIdTypeId,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="requestor_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.requestorId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="requestor_birthdate = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.requestorBirthdate,jdbcType=DATE}
        </foreach>
      </trim>
      <trim prefix="requestor_gender = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.requestorGender,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="`status` = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="wechat_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.wechatId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_customer_fortune_withdraw
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="customer_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.customerId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="lottery_draws_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.lotteryDrawsId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.lotteryDrawsId,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="withdraw_before_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.withdrawBeforeAmount != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawBeforeAmount,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="withdraw_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.withdrawAmount != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="withdraw_after_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.withdrawAfterAmount != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAfterAmount,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="is_paid = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.isPaid != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.isPaid,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="paid_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.paidDate != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.paidDate,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="paid_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.paidAmount != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.paidAmount,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="tax_amount = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.taxAmount != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="paid_method = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.paidMethod != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="requestor_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.requestorName != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.requestorName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="requestor_id_type_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.requestorIdTypeId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.requestorIdTypeId,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="requestor_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.requestorId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.requestorId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="requestor_birthdate = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.requestorBirthdate != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.requestorBirthdate,jdbcType=DATE}
          </if>
        </foreach>
      </trim>
      <trim prefix="requestor_gender = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.requestorGender != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.requestorGender,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="`status` = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.status != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="wechat_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.wechatId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.wechatId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdAt != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdBy != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer_fortune_withdraw
    (customer_id, lottery_draws_id, withdraw_before_amount, withdraw_amount, withdraw_after_amount, 
      is_paid, paid_date, paid_amount, tax_amount, paid_method, requestor_name, requestor_id_type_id, 
      requestor_id, requestor_birthdate, requestor_gender, `status`, wechat_id, created_at, 
      created_by)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.customerId,jdbcType=BIGINT}, #{item.lotteryDrawsId,jdbcType=BIGINT}, #{item.withdrawBeforeAmount,jdbcType=DECIMAL},
        #{item.withdrawAmount,jdbcType=DECIMAL}, #{item.withdrawAfterAmount,jdbcType=DECIMAL},
        #{item.isPaid,jdbcType=INTEGER}, #{item.paidDate,jdbcType=TIMESTAMP}, #{item.paidAmount,jdbcType=DECIMAL},
        #{item.taxAmount,jdbcType=DECIMAL}, #{item.paidMethod,jdbcType=INTEGER}, #{item.requestorName,jdbcType=VARCHAR},
        #{item.requestorIdTypeId,jdbcType=BIGINT}, #{item.requestorId,jdbcType=VARCHAR},
        #{item.requestorBirthdate,jdbcType=DATE}, #{item.requestorGender,jdbcType=INTEGER},
        #{item.status,jdbcType=INTEGER}, #{item.wechatId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP},
        #{item.createdBy,jdbcType=BIGINT})
    </foreach>
  </insert>

  <select id="findFinalWithdrawNoPayByCustomerIds" parameterType="arraylist" resultType="java.util.Map">
    select w.customer_id customerId,
           group_concat(distinct w.id order by w.id) withdrawIds
    from ag_acl_customer_fortune_withdraw w
    left join ag_acl_customer_fortune f on f.withdrawed_id = w.id
    where w.customer_id in
            <foreach collection="list" item="item" separator="," open="(" close=")">
              #{item}
            </foreach>
    and w.is_paid != 1
    and (f.payout_batch_id = #{payoutBatchId,jdbcType=BIGINT} or w.withdraw_amount = 0)
    group by w.customer_id
    </select>

  <select id="findByIds" parameterType="list" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer_fortune_withdraw
    where id in
    <foreach collection="list" item="item" separator="," open="(" close=")">
      #{item}
    </foreach>
    </select>

  <select id="findFinalWithdrawPayByCustomerIds" resultType="java.util.Map">
    select customer_id customerId,
    group_concat(distinct id order by id) withdrawIds
    from ag_acl_customer_fortune_withdraw
    where customer_id in
    <foreach collection="list" item="item" separator="," open="(" close=")">
      #{item}
    </foreach>
    and is_paid = 1
    group by customer_id
    </select>

  <select id="findByFortuneIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer_fortune_withdraw
    where id in (select withdrawed_id from ag_acl_customer_fortune where id in
    <foreach collection="array" item="item" separator="," open="(" close=")">
      #{item}
    </foreach>
    )
  </select>
</mapper>