zhwl/zhwl-business/zhwl-prepaid-card/target/classes/mapper/prepaidCard/PrepaidCardLogMapper.xml
2025-07-01 17:54:58 +08:00

210 lines
8.0 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.zhwl.prepaidCard.mapper.PrepaidCardLogMapper">
<resultMap type="PrepaidCardLog" id="PrepaidCardLogResult">
<result property="id" column="id"/>
<result property="cardId" column="card_id"/>
<result property="accountNo" column="account_no"/>
<result property="accountType" column="account_type"/>
<result property="name" column="name"/>
<result property="balance" column="balance"/>
<result property="orderNo" column="order_no"/>
<result property="tradeType" column="trade_type"/>
<result property="amount" column="amount"/>
<result property="createTime" column="create_time"/>
<result property="title" column="title"/>
<result property="createBy" column="create_by"/>
<result property="status" column="status"/>
<result property="transactionId" column="transaction_id"/>
<result property="payNo" column="pay_no"/>
</resultMap>
<sql id="selectPrepaidCardLogVo">
select id, card_id,account_no, account_type, name, balance, order_no, trade_type, amount, create_time,title,create_by,status,transaction_id,pay_no
from zdy_prepaid_card_log
</sql>
<select id="selectPrepaidCardLogList" parameterType="PrepaidCardLog" resultMap="PrepaidCardLogResult">
<include refid="selectPrepaidCardLogVo"/>
<where>
<if test="accountNo != null and accountNo != ''">
and account_no = #{accountNo}
</if>
<if test="cardId != null and cardId != ''">
and card_id = #{cardId}
</if>
<if test="accountType != null and accountType != ''">
and account_type = #{accountType}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="tradeType != null and tradeType != ''">
and trade_type = #{tradeType}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectPrepaidCardLogById" parameterType="Long"
resultMap="PrepaidCardLogResult">
<include refid="selectPrepaidCardLogVo"/>
where id = #{id}
</select>
<insert id="insertPrepaidCardLog" parameterType="PrepaidCardLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_prepaid_card_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cardId !=null">
card_id,
</if>
<if test="accountNo != null and accountNo != ''">account_no,
</if>
<if test="accountType != null and accountType != ''">account_type,
</if>
<if test="name != null">name,
</if>
<if test="balance != null">balance,
</if>
<if test="orderNo != null">order_no,
</if>
<if test="tradeType != null and tradeType != ''">trade_type,
</if>
<if test="amount != null">amount,
</if>
<if test="createTime != null">create_time,
</if>
<if test="title != null">title,
</if>
<if test="createBy != null">create_by,
</if>
<if test="status != null">status,
</if>
<if test="payNo != null">pay_no,
</if>
<if test="refundCode != null">refund_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cardId !=null">
#{cardId},
</if>
<if test="accountNo != null and accountNo != ''">#{accountNo},
</if>
<if test="accountType != null and accountType != ''">#{accountType},
</if>
<if test="name != null">#{name},
</if>
<if test="balance != null">#{balance},
</if>
<if test="orderNo != null">#{orderNo},
</if>
<if test="tradeType != null and tradeType != ''">#{tradeType},
</if>
<if test="amount != null">#{amount},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="title != null">#{title},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="status != null">#{status},
</if>
<if test="payNo != null">#{payNo},
</if>
<if test="refundCode != null">#{refundCode},
</if>
</trim>
</insert>
<update id="updatePrepaidCardLog" parameterType="PrepaidCardLog">
update zdy_prepaid_card_log
<trim prefix="SET" suffixOverrides=",">
<if test="cardId !=null">
card_id = #{cardId},
</if>
<if test="accountNo != null and accountNo != ''">account_no =
#{accountNo},
</if>
<if test="accountType != null and accountType != ''">account_type =
#{accountType},
</if>
<if test="name != null">name =
#{name},
</if>
<if test="balance != null">balance =
#{balance},
</if>
<if test="orderNo != null">order_no =
#{orderNo},
</if>
<if test="tradeType != null and tradeType != ''">trade_type =
#{tradeType},
</if>
<if test="amount != null">amount =
#{amount},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="title != null">title =
#{title},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="transactionId != null">transaction_id =
#{transactionId},
</if>
<if test="payNo != null">pay_no =
#{payNo},
</if>
<if test="refundCode != null">refund_code =
#{refundCode},
</if>
</trim>
where id = #{id}
</update>
<delete id="deletePrepaidCardLogById" parameterType="Long">
delete from zdy_prepaid_card_log where id = #{id}
</delete>
<delete id="deletePrepaidCardLogByIds" parameterType="String">
delete from zdy_prepaid_card_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPrepaidCardLogByPayNo" parameterType="String" resultMap="PrepaidCardLogResult">
<include refid="selectPrepaidCardLogVo"/>
where pay_no = #{payNo}
</select>
<select id="selectFinishedLogByOrderNo" parameterType="PrepaidCardLog" resultMap="PrepaidCardLogResult">
<include refid="selectPrepaidCardLogVo"/>
where order_no = #{orderNo} and `status` = #{status} and trade_type=#{tradeType}
</select>
</mapper>