Files
cashier-client/src/main/resources/mapper/TbOrderPaymentMapper.xml
2024-10-10 16:46:34 +08:00

267 lines
9.8 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.chaozhanggui.system.cashierservice.dao.TbOrderPaymentMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="pay_type_id" jdbcType="VARCHAR" property="payTypeId" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="paid_amount" jdbcType="DECIMAL" property="paidAmount" />
<result column="has_refund_amount" jdbcType="DECIMAL" property="hasRefundAmount" />
<result column="pay_name" jdbcType="VARCHAR" property="payName" />
<result column="pay_type" jdbcType="VARCHAR" property="payType" />
<result column="received" jdbcType="DECIMAL" property="received" />
<result column="change_fee" jdbcType="DECIMAL" property="changeFee" />
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="billing_id" jdbcType="VARCHAR" property="billingId" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" />
<result column="auth_code" jdbcType="VARCHAR" property="authCode" />
<result column="refundable" jdbcType="VARCHAR" property="refundable" />
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
<result column="trade_number" jdbcType="VARCHAR" property="tradeNumber" />
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
</resultMap>
<sql id="Base_Column_List">
id, pay_type_id, amount, paid_amount, has_refund_amount, pay_name, pay_type, received,
change_fee, merchant_id, shop_id, billing_id, order_id, auth_code, refundable, created_at,
updated_at, trade_number, member_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_order_payment
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_order_payment
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment" keyProperty="id" useGeneratedKeys="true">
insert into tb_order_payment (id, pay_type_id, amount,
paid_amount, has_refund_amount, pay_name,
pay_type, received, change_fee,
merchant_id, shop_id, billing_id,
order_id, auth_code, refundable,
created_at, updated_at, trade_number,
member_id)
values (#{id,jdbcType=INTEGER}, #{payTypeId,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
#{paidAmount,jdbcType=DECIMAL}, #{hasRefundAmount,jdbcType=DECIMAL}, #{payName,jdbcType=VARCHAR},
#{payType,jdbcType=VARCHAR}, #{received,jdbcType=DECIMAL}, #{changeFee,jdbcType=DECIMAL},
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
#{orderId,jdbcType=VARCHAR}, #{authCode,jdbcType=VARCHAR}, #{refundable,jdbcType=VARCHAR},
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{tradeNumber,jdbcType=VARCHAR},
#{memberId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment">
insert into tb_order_payment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="payTypeId != null">
pay_type_id,
</if>
<if test="amount != null">
amount,
</if>
<if test="paidAmount != null">
paid_amount,
</if>
<if test="hasRefundAmount != null">
has_refund_amount,
</if>
<if test="payName != null">
pay_name,
</if>
<if test="payType != null">
pay_type,
</if>
<if test="received != null">
received,
</if>
<if test="changeFee != null">
change_fee,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="billingId != null">
billing_id,
</if>
<if test="orderId != null">
order_id,
</if>
<if test="authCode != null">
auth_code,
</if>
<if test="refundable != null">
refundable,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="tradeNumber != null">
trade_number,
</if>
<if test="memberId != null">
member_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="payTypeId != null">
#{payTypeId,jdbcType=VARCHAR},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="paidAmount != null">
#{paidAmount,jdbcType=DECIMAL},
</if>
<if test="hasRefundAmount != null">
#{hasRefundAmount,jdbcType=DECIMAL},
</if>
<if test="payName != null">
#{payName,jdbcType=VARCHAR},
</if>
<if test="payType != null">
#{payType,jdbcType=VARCHAR},
</if>
<if test="received != null">
#{received,jdbcType=DECIMAL},
</if>
<if test="changeFee != null">
#{changeFee,jdbcType=DECIMAL},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
#{shopId,jdbcType=VARCHAR},
</if>
<if test="billingId != null">
#{billingId,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
#{orderId,jdbcType=VARCHAR},
</if>
<if test="authCode != null">
#{authCode,jdbcType=VARCHAR},
</if>
<if test="refundable != null">
#{refundable,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=BIGINT},
</if>
<if test="tradeNumber != null">
#{tradeNumber,jdbcType=VARCHAR},
</if>
<if test="memberId != null">
#{memberId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment">
update tb_order_payment
<set>
<if test="payTypeId != null">
pay_type_id = #{payTypeId,jdbcType=VARCHAR},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="paidAmount != null">
paid_amount = #{paidAmount,jdbcType=DECIMAL},
</if>
<if test="hasRefundAmount != null">
has_refund_amount = #{hasRefundAmount,jdbcType=DECIMAL},
</if>
<if test="payName != null">
pay_name = #{payName,jdbcType=VARCHAR},
</if>
<if test="payType != null">
pay_type = #{payType,jdbcType=VARCHAR},
</if>
<if test="received != null">
received = #{received,jdbcType=DECIMAL},
</if>
<if test="changeFee != null">
change_fee = #{changeFee,jdbcType=DECIMAL},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=VARCHAR},
</if>
<if test="billingId != null">
billing_id = #{billingId,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=VARCHAR},
</if>
<if test="authCode != null">
auth_code = #{authCode,jdbcType=VARCHAR},
</if>
<if test="refundable != null">
refundable = #{refundable,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=BIGINT},
</if>
<if test="tradeNumber != null">
trade_number = #{tradeNumber,jdbcType=VARCHAR},
</if>
<if test="memberId != null">
member_id = #{memberId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment">
update tb_order_payment
set pay_type_id = #{payTypeId,jdbcType=VARCHAR},
amount = #{amount,jdbcType=DECIMAL},
paid_amount = #{paidAmount,jdbcType=DECIMAL},
has_refund_amount = #{hasRefundAmount,jdbcType=DECIMAL},
pay_name = #{payName,jdbcType=VARCHAR},
pay_type = #{payType,jdbcType=VARCHAR},
received = #{received,jdbcType=DECIMAL},
change_fee = #{changeFee,jdbcType=DECIMAL},
merchant_id = #{merchantId,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR},
billing_id = #{billingId,jdbcType=VARCHAR},
order_id = #{orderId,jdbcType=VARCHAR},
auth_code = #{authCode,jdbcType=VARCHAR},
refundable = #{refundable,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=BIGINT},
trade_number = #{tradeNumber,jdbcType=VARCHAR},
member_id = #{memberId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByOrderId" resultMap="BaseResultMap">
select * from tb_order_payment where order_id=#{orderId}
</select>
<select id="selectListByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.TbOrderPayment">
select * from tb_order_payment where order_id = #{orderId}
</select>
</mapper>