Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/ClearingBillInfoMapper.xml
2025-02-20 15:31:32 +08:00

792 lines
30 KiB
XML

<?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.jsowell.pile.mapper.ClearingBillInfoMapper">
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.ClearingBillInfo">
<!--@mbg.generated-->
<!--@Table clearing_bill_info-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="bill_status" jdbcType="VARCHAR" property="billStatus" />
<result column="trade_date" jdbcType="VARCHAR" property="tradeDate" />
<result column="clearing_bill_code" jdbcType="VARCHAR" property="clearingBillCode" />
<result column="clearing_time" jdbcType="TIMESTAMP" property="clearingTime" />
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
<result column="order_source" jdbcType="VARCHAR" property="orderSource" />
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount" />
<result column="receivable_amount" jdbcType="DECIMAL" property="receivableAmount" />
<result column="should_clearing_amount" jdbcType="DECIMAL" property="shouldClearingAmount" />
<result column="actual_clearing_amount" jdbcType="DECIMAL" property="actualClearingAmount" />
<result column="fee_amount" jdbcType="DECIMAL" property="feeAmount" />
<result column="withdrawable_amount" jdbcType="DECIMAL" property="withdrawableAmount" />
<result column="withdraw_code" jdbcType="VARCHAR" property="withdrawCode" />
<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" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, bill_status, trade_date, clearing_bill_code, clearing_time, merchant_id, order_source,
settle_amount, receivable_amount, should_clearing_amount, actual_clearing_amount,
fee_amount, withdrawable_amount, withdraw_code, create_by, create_time, update_by,
update_time, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from clearing_bill_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from clearing_bill_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ClearingBillInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into clearing_bill_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="billStatus != null">
bill_status,
</if>
<if test="tradeDate != null">
trade_date,
</if>
<if test="clearingBillCode != null">
clearing_bill_code,
</if>
<if test="clearingTime != null">
clearing_time,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="orderSource != null">
order_source,
</if>
<if test="settleAmount != null">
settle_amount,
</if>
<if test="receivableAmount != null">
receivable_amount,
</if>
<if test="shouldClearingAmount != null">
should_clearing_amount,
</if>
<if test="actualClearingAmount != null">
actual_clearing_amount,
</if>
<if test="feeAmount != null">
fee_amount,
</if>
<if test="withdrawableAmount != null">
withdrawable_amount,
</if>
<if test="withdrawCode != null">
withdraw_code,
</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>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billStatus != null">
#{billStatus,jdbcType=VARCHAR},
</if>
<if test="tradeDate != null">
#{tradeDate,jdbcType=VARCHAR},
</if>
<if test="clearingBillCode != null">
#{clearingBillCode,jdbcType=VARCHAR},
</if>
<if test="clearingTime != null">
#{clearingTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=VARCHAR},
</if>
<if test="orderSource != null">
#{orderSource,jdbcType=VARCHAR},
</if>
<if test="settleAmount != null">
#{settleAmount,jdbcType=DECIMAL},
</if>
<if test="receivableAmount != null">
#{receivableAmount,jdbcType=DECIMAL},
</if>
<if test="shouldClearingAmount != null">
#{shouldClearingAmount,jdbcType=DECIMAL},
</if>
<if test="actualClearingAmount != null">
#{actualClearingAmount,jdbcType=DECIMAL},
</if>
<if test="feeAmount != null">
#{feeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawableAmount != null">
#{withdrawableAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawCode != null">
#{withdrawCode,jdbcType=VARCHAR},
</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>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.ClearingBillInfo">
<!--@mbg.generated-->
update clearing_bill_info
<set>
<if test="billStatus != null">
bill_status = #{billStatus,jdbcType=VARCHAR},
</if>
<if test="tradeDate != null">
trade_date = #{tradeDate,jdbcType=VARCHAR},
</if>
<if test="clearingBillCode != null">
clearing_bill_code = #{clearingBillCode,jdbcType=VARCHAR},
</if>
<if test="clearingTime != null">
clearing_time = #{clearingTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId,jdbcType=VARCHAR},
</if>
<if test="orderSource != null">
order_source = #{orderSource,jdbcType=VARCHAR},
</if>
<if test="settleAmount != null">
settle_amount = #{settleAmount,jdbcType=DECIMAL},
</if>
<if test="receivableAmount != null">
receivable_amount = #{receivableAmount,jdbcType=DECIMAL},
</if>
<if test="shouldClearingAmount != null">
should_clearing_amount = #{shouldClearingAmount,jdbcType=DECIMAL},
</if>
<if test="actualClearingAmount != null">
actual_clearing_amount = #{actualClearingAmount,jdbcType=DECIMAL},
</if>
<if test="feeAmount != null">
fee_amount = #{feeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawableAmount != null">
withdrawable_amount = #{withdrawableAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawCode != null">
withdraw_code = #{withdrawCode,jdbcType=VARCHAR},
</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>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update clearing_bill_info
<trim prefix="set" suffixOverrides=",">
<trim prefix="bill_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.billStatus,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="trade_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.tradeDate,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="clearing_bill_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingBillCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="clearing_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="merchant_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="order_source = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderSource,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="settle_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.settleAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="receivable_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.receivableAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="should_clearing_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.shouldClearingAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="actual_clearing_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.actualClearingAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="fee_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.feeAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="withdrawable_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawableAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="withdraw_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="del_flag = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update clearing_bill_info
<trim prefix="set" suffixOverrides=",">
<trim prefix="bill_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.billStatus != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.billStatus,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="trade_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.tradeDate != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.tradeDate,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="clearing_bill_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.clearingBillCode != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingBillCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="clearing_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.clearingTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="merchant_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.merchantId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="order_source = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderSource != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderSource,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="settle_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.settleAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.settleAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="receivable_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.receivableAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.receivableAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="should_clearing_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.shouldClearingAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.shouldClearingAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="actual_clearing_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.actualClearingAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.actualClearingAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="fee_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.feeAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.feeAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="withdrawable_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawableAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawableAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="withdraw_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawCode != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="del_flag = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.delFlag != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into clearing_bill_info
(bill_status, trade_date, clearing_bill_code, clearing_time, merchant_id, order_source,
settle_amount, receivable_amount, should_clearing_amount, actual_clearing_amount,
fee_amount, withdrawable_amount, withdraw_code, create_by, create_time, update_by,
update_time, del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.billStatus,jdbcType=VARCHAR}, #{item.tradeDate,jdbcType=VARCHAR}, #{item.clearingBillCode,jdbcType=VARCHAR},
#{item.clearingTime,jdbcType=TIMESTAMP}, #{item.merchantId,jdbcType=VARCHAR}, #{item.orderSource,jdbcType=VARCHAR},
#{item.settleAmount,jdbcType=DECIMAL}, #{item.receivableAmount,jdbcType=DECIMAL},
#{item.shouldClearingAmount,jdbcType=DECIMAL}, #{item.actualClearingAmount,jdbcType=DECIMAL},
#{item.feeAmount,jdbcType=DECIMAL}, #{item.withdrawableAmount,jdbcType=DECIMAL},
#{item.withdrawCode,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ClearingBillInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into clearing_bill_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
bill_status,
trade_date,
clearing_bill_code,
clearing_time,
merchant_id,
order_source,
settle_amount,
receivable_amount,
should_clearing_amount,
actual_clearing_amount,
fee_amount,
withdrawable_amount,
withdraw_code,
create_by,
create_time,
update_by,
update_time,
del_flag,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{billStatus,jdbcType=VARCHAR},
#{tradeDate,jdbcType=VARCHAR},
#{clearingBillCode,jdbcType=VARCHAR},
#{clearingTime,jdbcType=TIMESTAMP},
#{merchantId,jdbcType=VARCHAR},
#{orderSource,jdbcType=VARCHAR},
#{settleAmount,jdbcType=DECIMAL},
#{receivableAmount,jdbcType=DECIMAL},
#{shouldClearingAmount,jdbcType=DECIMAL},
#{actualClearingAmount,jdbcType=DECIMAL},
#{feeAmount,jdbcType=DECIMAL},
#{withdrawableAmount,jdbcType=DECIMAL},
#{withdrawCode,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
bill_status = #{billStatus,jdbcType=VARCHAR},
trade_date = #{tradeDate,jdbcType=VARCHAR},
clearing_bill_code = #{clearingBillCode,jdbcType=VARCHAR},
clearing_time = #{clearingTime,jdbcType=TIMESTAMP},
merchant_id = #{merchantId,jdbcType=VARCHAR},
order_source = #{orderSource,jdbcType=VARCHAR},
settle_amount = #{settleAmount,jdbcType=DECIMAL},
receivable_amount = #{receivableAmount,jdbcType=DECIMAL},
should_clearing_amount = #{shouldClearingAmount,jdbcType=DECIMAL},
actual_clearing_amount = #{actualClearingAmount,jdbcType=DECIMAL},
fee_amount = #{feeAmount,jdbcType=DECIMAL},
withdrawable_amount = #{withdrawableAmount,jdbcType=DECIMAL},
withdraw_code = #{withdrawCode,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ClearingBillInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into clearing_bill_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="billStatus != null">
bill_status,
</if>
<if test="tradeDate != null">
trade_date,
</if>
<if test="clearingBillCode != null">
clearing_bill_code,
</if>
<if test="clearingTime != null">
clearing_time,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="orderSource != null">
order_source,
</if>
<if test="settleAmount != null">
settle_amount,
</if>
<if test="receivableAmount != null">
receivable_amount,
</if>
<if test="shouldClearingAmount != null">
should_clearing_amount,
</if>
<if test="actualClearingAmount != null">
actual_clearing_amount,
</if>
<if test="feeAmount != null">
fee_amount,
</if>
<if test="withdrawableAmount != null">
withdrawable_amount,
</if>
<if test="withdrawCode != null">
withdraw_code,
</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>
<if test="delFlag != null">
del_flag,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="billStatus != null">
#{billStatus,jdbcType=VARCHAR},
</if>
<if test="tradeDate != null">
#{tradeDate,jdbcType=VARCHAR},
</if>
<if test="clearingBillCode != null">
#{clearingBillCode,jdbcType=VARCHAR},
</if>
<if test="clearingTime != null">
#{clearingTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=VARCHAR},
</if>
<if test="orderSource != null">
#{orderSource,jdbcType=VARCHAR},
</if>
<if test="settleAmount != null">
#{settleAmount,jdbcType=DECIMAL},
</if>
<if test="receivableAmount != null">
#{receivableAmount,jdbcType=DECIMAL},
</if>
<if test="shouldClearingAmount != null">
#{shouldClearingAmount,jdbcType=DECIMAL},
</if>
<if test="actualClearingAmount != null">
#{actualClearingAmount,jdbcType=DECIMAL},
</if>
<if test="feeAmount != null">
#{feeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawableAmount != null">
#{withdrawableAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawCode != null">
#{withdrawCode,jdbcType=VARCHAR},
</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>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="billStatus != null">
bill_status = #{billStatus,jdbcType=VARCHAR},
</if>
<if test="tradeDate != null">
trade_date = #{tradeDate,jdbcType=VARCHAR},
</if>
<if test="clearingBillCode != null">
clearing_bill_code = #{clearingBillCode,jdbcType=VARCHAR},
</if>
<if test="clearingTime != null">
clearing_time = #{clearingTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId,jdbcType=VARCHAR},
</if>
<if test="orderSource != null">
order_source = #{orderSource,jdbcType=VARCHAR},
</if>
<if test="settleAmount != null">
settle_amount = #{settleAmount,jdbcType=DECIMAL},
</if>
<if test="receivableAmount != null">
receivable_amount = #{receivableAmount,jdbcType=DECIMAL},
</if>
<if test="shouldClearingAmount != null">
should_clearing_amount = #{shouldClearingAmount,jdbcType=DECIMAL},
</if>
<if test="actualClearingAmount != null">
actual_clearing_amount = #{actualClearingAmount,jdbcType=DECIMAL},
</if>
<if test="feeAmount != null">
fee_amount = #{feeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawableAmount != null">
withdrawable_amount = #{withdrawableAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawCode != null">
withdraw_code = #{withdrawCode,jdbcType=VARCHAR},
</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>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selectByMerchantId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from clearing_bill_info
where del_flag = '0'
and merchant_id = #{merchantId,jdbcType=VARCHAR}
<if test="billStatus != null and billStatus != ''">
and bill_status = #{billStatus,jdbcType=VARCHAR}
</if>
<if test="tradeDate != null and tradeDate != ''">
and trade_date = #{tradeDate,jdbcType=VARCHAR}
</if>
order by create_time DESC
</select>
<update id="updateStatus">
update clearing_bill_info
set bill_status = #{billStatus,jdbcType=VARCHAR}, withdraw_code = #{withdrawCode,jdbcType=VARCHAR}
where id in
<foreach close=")" collection="clearingBillIds" item="item" open="(" separator=",">
#{item,jdbcType=INTEGER}
</foreach>
</update>
<select id="getMerchantClearingBillList" parameterType="com.jsowell.pile.dto.GetClearingBillDTO" resultType="com.jsowell.pile.vo.web.MerchantClearingBillVO">
select
t1.trade_date as tradeDate,
t1.bill_status as billStatus,
t1.clearing_bill_code as clearingBillCode,
t1.clearing_time as clearingTime,
t1.merchant_id as merchantId,
t2.merchant_name as merchantName,
t1.receivable_amount as receivableAmount,
t1.should_clearing_amount as shouldClearingAmount,
t1.actual_clearing_amount as actualClearingAmount,
t1.fee_amount as feeAmount,
t1.withdrawable_amount as withdrawAbleAmount,
t1.withdraw_code as withdrawCode,
t3.application_time as applicationTime
from clearing_bill_info t1
join pile_merchant_info t2 on t1.merchant_id = t2.id and t1.del_flag = '0'
left join clearing_withdraw_info t3 on t3.withdraw_code = t1.withdraw_code and t3.del_flag = '0'
where t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
and t1.trade_date between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
order by
t1.trade_date desc
</select>
<select id="selectByWithdrawCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from clearing_bill_info
where del_flag = '0'
and withdraw_code = #{withdrawCode,jdbcType=VARCHAR}
</select>
</mapper>