Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/LinePayMapper.xml
2025-08-20 14:25:57 +08:00

461 lines
18 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.cool.store.mapper.LinePayMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.LinePayDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="partner_id" jdbcType="VARCHAR" property="partnerId"/>
<result column="shop_id" jdbcType="BIGINT" property="shopId"/>
<result column="line_id" jdbcType="BIGINT" property="lineId"/>
<result column="pay_status" jdbcType="TINYINT" property="payStatus"/>
<result column="pay_type" jdbcType="TINYINT" property="payType"/>
<result column="pay_user_name" jdbcType="VARCHAR" property="payUserName"/>
<result column="pay_account" jdbcType="VARCHAR" property="payAccount"/>
<result column="bank_code" jdbcType="VARCHAR" property="bankCode"/>
<result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
<result column="branch_bank_code" jdbcType="VARCHAR" property="branchBankCode"/>
<result column="branch_bank_name" jdbcType="VARCHAR" property="branchBankName"/>
<result column="pay_time" jdbcType="TIMESTAMP" property="payTime"/>
<result column="pay_pic" jdbcType="VARCHAR" property="payPic"/>
<result column="promise_pic" jdbcType="VARCHAR" property="promisePic"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="deleted" jdbcType="BIT" property="deleted"/>
<result column="pay_business_type" jdbcType="TINYINT" property="payBusinessType"/>
<result column="amount" jdbcType="DECIMAL" property="amount"/>
<result column="combined_field" jdbcType="VARCHAR" property="combinedField"/>
<result column="xgj_claim_status" jdbcType="TINYINT" property="xgjClaimStatus"/>
<result column="payment_receipt_code" jdbcType="VARCHAR" property="paymentReceiptCode"/>
<result column="pay_serial_number" jdbcType="VARCHAR" property="paySerialNumber"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
id,shop_id, partner_id, line_id, pay_status, pay_type, pay_user_name, pay_account, bank_code,
bank_name, branch_bank_code, branch_bank_name, pay_time, pay_pic, promise_pic, create_time,
update_time, create_user_id, update_user_id,
deleted,pay_business_type,amount,combined_field,xgj_claim_status,payment_receipt_code,pay_serial_number,
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xfsg_line_pay
where id = #{id,jdbcType=BIGINT} and deleted = 0
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xfsg_line_pay
where id = #{id,jdbcType=BIGINT}
</delete>
<update id="deleteByShopId">
update xfsg_line_pay
set deleted = 1
where shop_id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<insert id="insertSelective" parameterType="com.cool.store.entity.LinePayDO">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into xfsg_line_pay
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="partnerId != null">
partner_id,
</if>
<if test="lineId != null">
line_id,
</if>
<if test="payStatus != null">
pay_status,
</if>
<if test="payType != null">
pay_type,
</if>
<if test="payUserName != null">
pay_user_name,
</if>
<if test="payAccount != null">
pay_account,
</if>
<if test="bankCode != null">
bank_code,
</if>
<if test="bankName != null">
bank_name,
</if>
<if test="branchBankCode != null">
branch_bank_code,
</if>
<if test="branchBankName != null">
branch_bank_name,
</if>
pay_time,
pay_pic,
<if test="promisePic != null">
promise_pic,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="payBusinessType !=null">
pay_business_type,
</if>
<if test="shopId !=null">
shop_id,
</if>
<if test="amount != null">
amount,
</if>
<if test="combinedField != null">
combined_field,
</if>
<if test="xgjClaimStatus !=null">
xgj_claim_status,
</if>
<if test="paymentReceiptCode !=null">
payment_receipt_code,
</if>
<if test="paySerialNumber !=null">
pay_serial_number,
</if>
<if test="remark != null">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="partnerId != null">
#{partnerId,jdbcType=VARCHAR},
</if>
<if test="lineId != null">
#{lineId,jdbcType=BIGINT},
</if>
<if test="payStatus != null">
#{payStatus,jdbcType=TINYINT},
</if>
<if test="payType != null">
#{payType,jdbcType=TINYINT},
</if>
<if test="payUserName != null">
#{payUserName,jdbcType=VARCHAR},
</if>
<if test="payAccount != null">
#{payAccount,jdbcType=VARCHAR},
</if>
<if test="bankCode != null">
#{bankCode,jdbcType=VARCHAR},
</if>
<if test="bankName != null">
#{bankName,jdbcType=VARCHAR},
</if>
<if test="branchBankCode != null">
#{branchBankCode,jdbcType=VARCHAR},
</if>
<if test="branchBankName != null">
#{branchBankName,jdbcType=VARCHAR},
</if>
#{payTime,jdbcType=TIMESTAMP},
#{payPic,jdbcType=VARCHAR},
<if test="promisePic != null">
#{promisePic,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=VARCHAR},
</if>
<if test="updateUserId != null">
#{updateUserId,jdbcType=VARCHAR},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="payBusinessType !=null">
#{payBusinessType,jdbcType=TINYINT},
</if>
<if test="shopId !=null">
#{shopId},
</if>
<if test="amount !=null">
#{amount},
</if>
<if test="combinedField != null">
#{combinedField,jdbcType=VARCHAR},
</if>
<if test="xgjClaimStatus !=null">
#{xgjClaimStatus,jdbcType=TINYINT},
</if>
<if test="paymentReceiptCode !=null">
#{paymentReceiptCode,jdbcType=VARCHAR},
</if>
<if test="paySerialNumber !=null">
#{paySerialNumber,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR}
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.LinePayDO">
update xfsg_line_pay
<set>
<if test="partnerId != null">
partner_id = #{partnerId,jdbcType=VARCHAR},
</if>
<if test="lineId != null">
line_id = #{lineId,jdbcType=BIGINT},
</if>
<if test="payStatus != null">
pay_status = #{payStatus,jdbcType=TINYINT},
</if>
<if test="payType != null">
pay_type = #{payType,jdbcType=TINYINT},
</if>
<if test="payUserName != null">
pay_user_name = #{payUserName,jdbcType=VARCHAR},
</if>
<if test="payAccount != null">
pay_account = #{payAccount,jdbcType=VARCHAR},
</if>
<if test="bankCode != null">
bank_code = #{bankCode,jdbcType=VARCHAR},
</if>
<if test="bankName != null">
bank_name = #{bankName,jdbcType=VARCHAR},
</if>
<if test="branchBankCode != null">
branch_bank_code = #{branchBankCode,jdbcType=VARCHAR},
</if>
<if test="branchBankName != null">
branch_bank_name = #{branchBankName,jdbcType=VARCHAR},
</if>
pay_time = #{payTime,jdbcType=TIMESTAMP},
pay_pic = #{payPic,jdbcType=VARCHAR},
<if test="promisePic != null">
promise_pic = #{promisePic,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=VARCHAR},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=VARCHAR},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=VARCHAR},
</if>
<if test="combinedField != null">
combined_field = #{combinedField,jdbcType=VARCHAR},
</if>
<if test="xgjClaimStatus !=null">
xgj_claim_status = #{xgjClaimStatus,jdbcType=TINYINT},
</if>
<if test="paymentReceiptCode !=null">
payment_receipt_code = #{paymentReceiptCode,jdbcType=VARCHAR},
</if>
<if test="paySerialNumber !=null">
pay_serial_number = #{paySerialNumber,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR}
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPidAndLid">
update xfsg_line_pay
set audit_id = #{auditId}
where line_id = #{lineId}
and partner_id = #{partnerId}
</update>
<sql id="dynamicQuery">
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="null != id">
and t.id = #{id,jdbcType=BIGINT}
</if>
<if test="null != partnerId">
and t.partner_id = #{partnerId,jdbcType=VARCHAR}
</if>
<if test="null != lineId">
and t.line_id = #{lineId,jdbcType=BIGINT}
</if>
<if test="null != payStatus">
and t.pay_status = #{payStatus,jdbcType=TINYINT}
</if>
<if test="null != payType">
and t.pay_type = #{payType,jdbcType=TINYINT}
</if>
<if test="null != payUserName">
and t.pay_user_name = #{payUserName,jdbcType=VARCHAR}
</if>
<if test="null != payAccount">
and t.pay_account = #{payAccount,jdbcType=VARCHAR}
</if>
<if test="null != bankCode">
and t.bank_code = #{bankCode,jdbcType=VARCHAR}
</if>
<if test="null != bankName">
and t.bank_name = #{bankName,jdbcType=VARCHAR}
</if>
<if test="null != branchBankCode">
and t.branch_bank_code = #{branchBankCode,jdbcType=VARCHAR}
</if>
<if test="null != branchBankName">
and t.branch_bank_name = #{branchBankName,jdbcType=VARCHAR}
</if>
<if test="null != payTime">
and t.pay_time = #{payTime,jdbcType=TIMESTAMP}
</if>
<if test="null != payPic">
and t.pay_pic = #{payPic,jdbcType=VARCHAR}
</if>
<if test="null != promisePic">
and t.promise_pic = #{promisePic,jdbcType=VARCHAR}
</if>
<if test="null != createTime">
and t.create_time = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="null != updateTime">
and t.update_time = #{updateTime,jdbcType=TIMESTAMP}
</if>
<if test="null != createUserId">
and t.create_user_id = #{createUserId,jdbcType=VARCHAR}
</if>
<if test="null != updateUserId">
and t.update_user_id = #{updateUserId,jdbcType=VARCHAR}
</if>
<if test="null != deleted">
and t.deleted = #{deleted,jdbcType=BIT}
</if>
</trim>
</sql>
<select id="getLinePayByLineId" resultMap="BaseResultMap">
select *
from xfsg_line_pay
where line_id = #{lineId}
and deleted = '0' limit 1
</select>
<select id="getByLineIdAndPayTypeAndShopId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xfsg_line_pay
<where>
deleted = '0'
and pay_business_type = #{payBusinessType}
<if test="lineId != null and lineId != ''">
and line_id = #{lineId}
</if>
<if test="shopId != null and shopId != ''">
and shop_id = #{shopId}
</if>
limit 1
</where>
</select>
<select id="getLinePayByLineIds" resultMap="BaseResultMap">
select * from xfsg_line_pay where deleted = 0
<if test="businessType!=null">
and pay_business_type = #{businessType}
</if>
<if test="lineIds !=null and lineIds.size>0">
<foreach collection="lineIds" item="lineId" open="and line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
<if test="shopIds !=null and shopIds.size>0">
<foreach collection="shopIds" item="shopId" open="and shop_id in (" close=")" separator=",">
#{shopId}
</foreach>
</if>
</select>
<select id="getFranchiseFeePayInfoByShopId" resultType="com.cool.store.entity.LinePayDO">
select * from xfsg_line_pay where deleted = 0 and shop_id = #{shopId} and pay_business_type = 1 order by
create_time desc
</select>
<select id="getDateHandler" resultType="com.cool.store.entity.LinePayDO">
select * from xfsg_line_pay where deleted = 0 and pay_business_type = 1 and pay_pic is null and combined_field
is not null
</select>
<update id="deleteById">
update xfsg_line_pay set deleted = 1 ,update_time = now(),update_user_id = #{userId} where id = #{id}
</update>
<select id="selectByPaymentReceiptCode" resultType="com.cool.store.entity.LinePayDO">
select * from xfsg_line_pay where deleted = 0 and payment_receipt_code = #{paymentReceiptCode} and
pay_business_type = 1 order by create_time desc
</select>
<select id="getLastPay" resultMap="BaseResultMap">
select * from xfsg_line_pay
where deleted = 0
and shop_id = #{shopId}
and pay_business_type = 1
and xgj_claim_status = 1
order by update_time desc limit 1
</select>
<update id="dataUpdateLinePay">
<foreach collection="list" separator=";" item="item" index="index">
update xfsg_line_pay
<set>
<if test="item.payTime !=null">
pay_time = #{item.payTime},
</if>
<if test="item.payPic !=null and item !=''">
pay_pic = #{item.payPic},
</if>
<if test="item.paymentReceiptCode!=null and item.paymentReceiptCode !=''">
payment_receipt_code = #{item.paymentReceiptCode},
</if>
<if test="item.xgjClaimStatus">
xgj_claim_status = #{item.xgjClaimStatus}
</if>
</set>
where id = #{item.id}
</foreach>
</update>
<update id="updateXgjClaimStatus">
update xfsg_line_pay
set
xgj_claim_status = #{xgjClaimStatus},
update_time = now()
where shop_id in (
<foreach collection="list" item="shopId" separator=",">
#{shopId}
</foreach>
) and pay_business_type = #{payBusinessType}
</update>
</mapper>