|
|
<?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.example.demo.mapper.cash.CashRefundMapper"> <insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> INSERT INTO cash_record_refund ( jwcode, name, market, order_code, bank_code, permanent_gold, free_gold, submitter_id, submitter_market, remark, reject_reason, refund_reason, refund_model, executor, refund_channels, refund_time, refund_remark, refund_voucher, refund_currency, refund_amount, related_id, audit_id, status ) VALUES ( #{jwcode}, #{name}, #{market}, #{orderCode}, #{bankCode}, #{partRefundGold}, #{partRefundFree}, #{submitterId}, #{submitterMarket}, #{remark}, #{rejectReason}, #{refundReason}, #{refundModel}, #{executor}, #{refundChannels}, #{refundTime}, #{refundRemark}, #{refundVoucher}, #{refundCurrency}, #{refundAmount}, #{originalOrderId}, #{auditId}, #{status} ); </insert> <insert id="addAudit" parameterType="com.example.demo.domain.vo.cash.CashRecordDone" useGeneratedKeys="true" keyProperty="id"> insert into lhl_audit (
area_servise, area_finance, area_charge, head_finance ) values(
#{areaServise}, #{areaFinance}, #{areaCharge}, #{headFinance} )
</insert> <!-- ✅ 正确写法:CashRefundMapper.xml --> <update id="update"> UPDATE cash_record_refund <set> status = 10, refund_model = #{refundModel}, refund_reason = #{refundReason}, <if test="newRefundGold != null"> permanent_gold = #{newRefundGold}, </if> <if test="newRefundFree != null"> free_gold = #{newRefundFree} <!-- 注意:最后一个字段不要加逗号!<set> 会自动处理 --> </if> </set> WHERE id = #{id} </update> <update id="withdraw"> update cash_record_refund set status = 11 where id = #{id} </update> <update id="review"> update cash_record_refund set status = #{status},executor = #{executor},reject_reason = #{rejectReason} where id = #{id} </update> <update id="executor"> update cash_record_refund set refund_currency = #{refundCurrency}, refund_amount = #{refundAmount}, refund_channels = #{refundChannels}, refund_time = #{refundTime}, refund_remark = #{refundRemark}, refund_voucher = #{refundVoucher}, status = #{status}, executor = #{executor} where id = #{id} </update> <update id="updateStatus"> update cash_record_collection set status = #{status} <where> <if test="id != null"> and id = #{id} </if> <if test="orderCode != null"> and order_code = #{orderCode} </if> </where> </update> <update id="updateAudit"> update lhl_audit <set> <if test="areaServise != null"> area_servise = #{areaServise}, </if> <if test="areaFinance != null"> area_finance = #{areaFinance}, </if> <if test="areaCharge != null"> area_charge = #{areaCharge}, </if> <if test="headFinance != null"> head_finance = #{headFinance}, </if> </set> where id = #{auditId} </update> <update id="updategold"> update user_gold_record set is_refund = 1 where order_code = #{orderCode} </update>
<select id="select" resultType="com.example.demo.domain.vo.cash.CashRecordDTO"> select crr.id, crr.jwcode, crr.name, crr.market, crr.permanent_gold, crr.free_gold, crr.audit_id, crr.status, crr.submitter_id, crr.submitter_market, crr.executor, crr.order_code, crr.refund_channels, crr.refund_time, crr.create_time, crr.update_time, crr.audit_time, crr.related_id, la.area_servise, la.area_finance, la.area_charge, la.head_finance, crc.activity, crc.goods_name, crc.good_num as goodsNum, crc.num_unit, crc.pay_type, crc.pay_time, crc.voucher, crc.remark, crr.refund_reason, crr.refund_remark, crr.reject_reason, crc.payment_currency, crc.payment_amount from cash_record_refund crr left join lhl_audit la on la.id = crr.audit_id left join cash_record_collection crc on crc.id = crr.related_id <where> <if test="status != null"> and crr.status = #{status} </if> <if test="name != null and name.length() > 0"> and crr.name like CONCAT('%', #{name}, '%') </if> <if test="jwcode != null"> and crr.jwcode = #{jwcode} </if> <if test="markets!= null and markets.size > 0"> AND crr.market IN <foreach collection="markets" item="markets" open="(" separator="," close=")"> #{markets} </foreach> </if> <if test="statuses!= null and statuses.size > 0"> AND crr.status IN <foreach collection="statuses" item="statuses" open="(" separator="," close=")"> #{statuses} </foreach> </if> <if test="paymentCurrency!= null and paymentCurrency.length() > 0"> AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%') </if>
<if test="goodsNames!= null and goodsNames.size > 0"> AND crc.goods_name IN <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")"> #{goodsNames} </foreach> </if> <if test="payType != null and payType.length()>0"> and crc.pay_type = #{payType} </if> <if test="startTime != null and endTime != null"> and crc.`pay_time` BETWEEN #{startTime} AND #{endTime} </if> <if test=" submitterId!= null"> and crr.submitter_id = #{submitterId} </if> </where> <choose> <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0"> ORDER BY ${sortField} ${sortOrder} </when> <otherwise> ORDER BY crr.update_time DESC </otherwise> </choose> </select> <select id="financeSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO"> select crr.id, crr.jwcode, crr.name, crr.market, crc.goods_name, crr.order_code, crc.good_num as goodsNum, crc.num_unit, crr.refund_model, crr.submitter_id, crr.executor, crr.refund_reason, crr.remark, crr.status, crr.permanent_gold, crr.free_gold, crr.audit_id, crr.related_id, crr.reject_reason, la.area_servise, la.area_finance, la.area_charge, la.head_finance from cash_record_refund crr left join cash_record_collection crc on crc.id = crr.related_id left join lhl_audit la on la.id = crr.audit_id <where> <if test="status != null"> and crr.status = #{status} </if> <if test="name != null and name.length() > 0"> and crr.name like CONCAT('%', #{name}, '%') </if> <if test="jwcode != null"> and crr.jwcode = #{jwcode} </if> <if test="markets!= null and markets.size > 0"> AND crr.market IN <foreach collection="markets" item="markets" open="(" separator="," close=")"> #{markets} </foreach> </if> <if test="statuses!= null and statuses.size > 0"> AND crr.status IN <foreach collection="statuses" item="statuses" open="(" separator="," close=")"> #{statuses} </foreach> </if> <if test="paymentCurrency!= null and paymentCurrency.length() > 0"> AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%') </if>
<!-- <if test="goodsNames!= null and goodsNames.size > 0">--><!-- AND crc.goods_name IN--><!-- <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">--><!-- #{goodsNames}--><!-- </foreach>--><!-- </if>--> <if test="goodsName!= null and goodsName.length() > 0"> and crc.goods_name = #{goodsName} </if> <if test="payType != null and payType.length()>0"> and crc.pay_type = #{payType} </if> <if test="startTime != null and endTime != null"> and crc.`pay_time` BETWEEN #{startTime} AND #{endTime} </if> <if test=" submitterId!= null"> and crr.submitter_id = #{submitterId} </if> </where> <choose> <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0"> ORDER BY ${sortField} ${sortOrder} </when> <otherwise> ORDER BY crr.update_time DESC </otherwise> </choose> </select> <select id="getAudit" resultType="com.example.demo.domain.vo.cash.LhlAudit"> select la.id, la.area_servise, la.area_finance, la.area_charge, la.head_finance from lhl_audit la where la.id = #{id} </select> <select id="exSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO"> select crr.id, crr.jwcode, crr.name, crr.market, crc.goods_name, crc.order_code, crc.good_num as goodsNum, crc.num_unit, crr.refund_model, crr.refund_currency, crr.refund_amount, crr.refund_channels, crr.refund_voucher, crr.refund_time, crr.executor, crr.permanent_gold, crr.free_gold, crr.status, crr.audit_id, crr.submitter_id, crr.related_id, crr.refund_reason, la.area_servise, la.area_finance, la.area_charge, la.head_finance from cash_record_refund crr left join cash_record_collection crc on crc.id = crr.related_id left join lhl_audit la on la.id = crr.audit_id <where> <if test="status != null"> and crr.status = #{status} </if> <if test="name != null and name.length() > 0"> and crr.name like CONCAT('%', #{name}, '%') </if> <if test="jwcode != null"> and crr.jwcode = #{jwcode} </if> <if test="markets!= null and markets.size > 0"> AND crr.market IN <foreach collection="markets" item="markets" open="(" separator="," close=")"> #{markets} </foreach> </if> <if test="statuses!= null and statuses.size > 0"> AND crr.status IN <foreach collection="statuses" item="statuses" open="(" separator="," close=")"> #{statuses} </foreach> </if>
<if test="goodsNames!= null and goodsNames.size > 0"> AND crc.goods_name IN <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")"> #{goodsNames} </foreach> </if> <if test="refundCurrency != null and refundCurrency.length() > 0"> AND crr.refund_currency like CONCAT('%', #{refundCurrency}, '%') </if> <if test="refundChannels != null and refundChannels.length()>0"> and crr.refund_channels like CONCAT('%', #{refundChannels}, '%') </if> <if test="sTime != null and eTime != null"> and crr.`refund_time` BETWEEN #{sTime} AND #{eTime} </if> <if test=" executor!= null"> and crr.executor = #{executor} </if> </where> <choose> <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0"> ORDER BY ${sortField} ${sortOrder} </when> <otherwise> ORDER BY crr.create_time DESC </otherwise> </choose> </select> <!-- 批量获取审核人信息 --> <select id="getAuditBatch" resultType="com.example.demo.domain.vo.cash.LhlAudit"> SELECT * FROM lhl_audit WHERE 1 = 0 <if test="auditIds != null and auditIds.size() > 0"> OR id IN <foreach collection="auditIds" item="id" open="(" separator="," close=")"> #{id} </foreach> </if> </select> <select id="selectById" resultType="com.example.demo.domain.vo.cash.CashRecordDTO"> select crr.id, crr.jwcode, crr.name, crr.status, crr.market, crr.audit_id, crr.submitter_id, crr.executor, crr.related_id, crr.order_code, crr.refund_reason, crr.remark, crr.reject_reason, crr.refund_model, crr.refund_currency, crr.refund_amount, crr.refund_channels, crr.refund_time, crr.refund_remark, crr.refund_voucher from cash_record_refund crr where crr.id = #{id} </select>
<select id="selectfunds" resultType="com.example.demo.domain.vo.cash.FundsDTO"> SELECT crc.id, crc.jwcode, crc.name, crc.market, crc.order_code, crc.payment_currency, ROUND(crc.payment_amount / 100.0, 2) as paymentAmount,
crc.received_currency, ROUND(crc.received_amount / 100.0, 2) as receivedAmount,
ROUND(crc.handling_charge / 100.0, 2) as handlingCharge, ROUND(crc.permanent_gold / 100.0, 2) as permanentGold, ROUND(crc.free_gold / 100.0, 2) as freeGold,
crc.pay_type, crc.pay_time, crc.status FROM cash_record_collection crc <where> <if test="jwcode != null"> and crc.jwcode = #{jwcode} </if> <if test="markets!= null and markets.size > 0"> AND crc.received_market IN <foreach collection="markets" item="markets" open="(" separator="," close=")"> #{markets} </foreach> </if> <if test="localMarket != null and localMarket.size > 0"> AND crc.market IN <foreach collection="localMarket" item="localMarket" open="(" separator="," close=")"> #{localMarket} </foreach> </if> <if test="startTime != null and endTime != null"> and crc.`pay_time` BETWEEN #{startTime} AND #{endTime} </if> <if test="payType!= null and payType.length > 0"> AND crc.pay_type like CONCAT('%', #{payType}, '%') </if> <if test="orderCode!= null and orderCode.length > 0"> AND crc.order_code like CONCAT('%', #{orderCode}, '%') </if> <if test="statuses!=null and statuses.size()>0"> and crc.status IN <foreach collection="statuses" item="statuses" open="(" separator="," close=")"> #{statuses} </foreach> </if> </where> <choose> <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0"> ORDER BY ${sortField} ${sortOrder} </when> <otherwise> ORDER BY crc.create_time DESC </otherwise> </choose> </select> <select id="selectRefundCount" resultType="com.example.demo.domain.vo.cash.FundsDTO"> select crr.refund_currency, crr.refund_amount, crr.related_id from cash_record_refund crr <where> <if test="needQueryIds != null and needQueryIds.size() > 0"> and crr.related_id IN <foreach collection="needQueryIds" item="needQueryId" open="(" separator="," close=")"> #{needQueryId} </foreach> </if> </where> </select>
<update id="updateMessageFlagByOrderId"> UPDATE message SET flag = 1 WHERE type_id = #{orderId} AND type = 0 </update></mapper>
|