exam-api/exam-admin/src/main/resources/mapper/payment/PaymentInfoMapper.xml

252 lines
9.5 KiB
XML
Raw Normal View History

2025-08-18 09:15:16 +08:00
<?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.yf.exam.modules.payment.mapper.PaymentInfoMapper">
<resultMap type="com.yf.exam.modules.payment.entity.PaymentInfo" id="PaymentInfoResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="examRegistrationId" column="exam_registration_id"/>
<result property="paymentTitle" column="payment_title"/>
<result property="transactionNo" column="transaction_no"/>
<result property="payPrice" column="pay_price"/>
<result property="payType" column="pay_type"/>
<result property="payChannel" column="pay_channel"/>
<result property="wechatTradeState" column="wechat_trade_state"/>
<result property="alipayTradeState" column="alipay_trade_state"/>
<result property="payNotifyContent" column="pay_notify_content"/>
<result property="payTime" column="pay_time"/>
<result property="paymentMerchantType" column="payment_merchant_type"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectPaymentInfoVo">
select id,
user_id,
exam_registration_id,
payment_title,
transaction_no,
pay_price,
pay_type,
pay_channel,
wechat_trade_state,
alipay_trade_state,
pay_notify_content,
pay_time,
payment_merchant_type,
del_flag,
create_by,
create_time,
update_by,
update_time
from payment_info
</sql>
<select id="selectPaymentInfoList" parameterType="com.yf.exam.modules.payment.entity.PaymentInfo" resultMap="PaymentInfoResult">
<include refid="selectPaymentInfoVo"/>
<where>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="examRegistrationId != null and examRegistrationId != ''">
and exam_registration_id = #{examRegistrationId}
</if>
<if test="paymentTitle != null and paymentTitle != ''">
and payment_title = #{paymentTitle}
</if>
<if test="transactionNo != null and transactionNo != ''">
and transaction_no = #{transactionNo}
</if>
<if test="payPrice != null ">
and pay_price = #{payPrice}
</if>
<if test="payType != null and payType != ''">
and pay_type = #{payType}
</if>
<if test="payChannel != null and payChannel != ''">
and pay_channel = #{payChannel}
</if>
<if test="wechatTradeState != null and wechatTradeState != ''">
and wechat_trade_state = #{wechatTradeState}
</if>
<if test="alipayTradeState != null and alipayTradeState != ''">
and alipay_trade_state = #{alipayTradeState}
</if>
<if test="payNotifyContent != null and payNotifyContent != ''">
and pay_notify_content = #{payNotifyContent}
</if>
<if test="payTime != null ">
and pay_time = #{payTime}
</if>
<if test="paymentMerchantType != null and paymentMerchantType != ''">
and payment_merchant_type = #{paymentMerchantType}
</if>
</where>
</select>
<select id="selectPaymentInfoById" parameterType="Long"
resultMap="PaymentInfoResult">
<include refid="selectPaymentInfoVo"/>
where id = #{id}
</select>
<insert id="insertPaymentInfo" parameterType="com.yf.exam.modules.payment.entity.PaymentInfo" useGeneratedKeys="true"
keyProperty="id">
insert into payment_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,
</if>
<if test="examRegistrationId != null">exam_registration_id,
</if>
<if test="paymentTitle != null">payment_title,
</if>
<if test="transactionNo != null">transaction_no,
</if>
<if test="payPrice != null">pay_price,
</if>
<if test="payType != null">pay_type,
</if>
<if test="payChannel != null">pay_channel,
</if>
<if test="wechatTradeState != null">wechat_trade_state,
</if>
<if test="alipayTradeState != null">alipay_trade_state,
</if>
<if test="payNotifyContent != null">pay_notify_content,
</if>
<if test="payTime != null">pay_time,
</if>
<if test="paymentMerchantType != null">payment_merchant_type,
</if>
<if test="delFlag != null">del_flag,
</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},
</if>
<if test="examRegistrationId != null">#{examRegistrationId},
</if>
<if test="paymentTitle != null">#{paymentTitle},
</if>
<if test="transactionNo != null">#{transactionNo},
</if>
<if test="payPrice != null">#{payPrice},
</if>
<if test="payType != null">#{payType},
</if>
<if test="payChannel != null">#{payChannel},
</if>
<if test="wechatTradeState != null">#{wechatTradeState},
</if>
<if test="alipayTradeState != null">#{alipayTradeState},
</if>
<if test="payNotifyContent != null">#{payNotifyContent},
</if>
<if test="payTime != null">#{payTime},
</if>
<if test="paymentMerchantType != null">#{paymentMerchantType},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updatePaymentInfo" parameterType="com.yf.exam.modules.payment.entity.PaymentInfo">
update payment_info
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id =
#{userId},
</if>
<if test="examRegistrationId != null">exam_registration_id =
#{examRegistrationId},
</if>
<if test="paymentTitle != null">payment_title =
#{paymentTitle},
</if>
<if test="transactionNo != null">transaction_no =
#{transactionNo},
</if>
<if test="payPrice != null">pay_price =
#{payPrice},
</if>
<if test="payType != null">pay_type =
#{payType},
</if>
<if test="payChannel != null">pay_channel =
#{payChannel},
</if>
<if test="wechatTradeState != null">wechat_trade_state =
#{wechatTradeState},
</if>
<if test="alipayTradeState != null">alipay_trade_state =
#{alipayTradeState},
</if>
<if test="payNotifyContent != null">pay_notify_content =
#{payNotifyContent},
</if>
<if test="payTime != null">pay_time =
#{payTime},
</if>
<if test="paymentMerchantType != null">payment_merchant_type =
#{paymentMerchantType},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deletePaymentInfoById" parameterType="Long">
delete
from payment_info
where id = #{id}
</delete>
<delete id="deletePaymentInfoByIds" parameterType="String">
delete from payment_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getByRegistrationId" parameterType="string" resultType="int">
select count(1) paymentCount
from payment_info
where exam_registration_id = #{examRegistrationId}
</select>
</mapper>