|
|
<?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"> INSERT INTO cash_record ( order_type, jwcode, name, market, activity, order_code, bank_code, goods_name, good_num, audit_id, payment_currency, payment_amount, received_currency, received_amount, handling_charge, received_market, pay_type, pay_time, received_time, status, submitter_id, voucher, remark, refund_reason, refund_model, executor, refund_channels, refund_time, refund_remark, refund_voucher ) VALUES ( #{orderType}, #{jwcode}, #{name}, #{market}, #{activity}, #{orderCode}, #{bankCode}, #{goodsName}, #{goodNum}, #{auditId}, #{paymentCurrency}, #{paymentAmount}, #{receivedCurrency}, #{receivedAmount}, #{handlingCharge}, #{receivedMarket}, #{payType}, #{payTime}, #{receivedTime}, #{status}, #{submitterId}, #{voucher}, #{remark}, #{refundReason}, #{refundModel}, #{executor}, #{refundChannels}, #{refundTime}, #{refundRemark}, #{refundVoucher} ); </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> <update id="update"> update cash_record set status = 10, refund_model = #{refundModel}, refund_reason = #{refundReason} where id = #{id} </update> <update id="withdraw"> update cash_record set status = 11 where order_type =2 and id = #{id} </update> <update id="review"> update cash_record set status = #{status},executor = #{executor},reject_reason = #{rejectReason} where order_type =2 and id = #{id} </update> <update id="executor"> update cash_record set refund_currency = #{refundCurrency}, refund_amount = #{refundAmount}, refund_channels = #{refundChannels}, refund_time = #{refundTime}, refund_remark = #{refundRemark}, refund_voucher = #{refundVoucher}, status = #{status}, executor = #{executor} where order_type =2 and id = #{id} </update> <update id="updateStatus"> update cash_record 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>
<select id="select" resultType="com.example.demo.domain.vo.cash.CashRecordDone"> select cr.id, cr.order_type, cr.jwcode, cr.name, cr.market, cr.activity, cr.order_code, cr.bank_code, cr.goods_name, cr.good_num, cr.payment_currency, Round((payment_amount) / 100.0, 2) AS PaymentAmount, cr.received_currency, Round((received_amount) / 100.0, 2) AS receivedAmount, Round((handling_charge) / 100.0, 2) AS handlingCharge, cr.pay_type, cr.received_market, cr.pay_time, cr.received_time, cr.audit_id, cr.status, cr.submitter_id, cr.voucher, cr.refund_reason, cr.refund_model, cr.executor, cr.refund_channels, cr.refund_time, cr.refund_remark, cr.refund_voucher, cr.remark, cr.reject_reason, cr.create_time, cr.update_time, cr.audit_time, a1.admin_name as submitterName, a3.admin_name as executorName, a2.area_servise, a2.area_finance, a2.area_charge, a2.head_finance, cr.refund_currency, cr.refund_amount, cr.permanent_gold, cr.free_gold, m.name as marketName from cash_record cr left join admin a1 on submitter_id = a1.id left join lhl_audit a2 on cr.audit_id = a2.id left join admin a3 on executor = a3.account left join market m on m.id = cr.market <where> cr.order_type = 2 <if test="status != null"> and cr.status = #{status} </if> <if test="orderCode != null"> and cr.order_code = #{orderCode} </if> <if test="name != null and name.length() > 0"> and cr.name = #{name} </if> <if test="jwcode != null"> and cr.jwcode = #{jwcode} </if> <if test="markets!= null and markets.size > 0"> AND cr.market IN <foreach collection="markets" item="markets" open="(" separator="," close=")"> #{markets} </foreach> </if> <if test="statuses!= null and statuses.size > 0"> AND cr.status IN <foreach collection="statuses" item="statuses" open="(" separator="," close=")"> #{statuses} </foreach> </if> <if test="paymentCurrency!= null and paymentCurrency.length() > 0"> AND cr.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%') </if>
<if test="goodsNames!= null and goodsNames.size > 0"> AND cr.goods_name IN <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")"> #{goodsNames} </foreach> </if> <if test="payType != null and payType.length()>0"> and cr.pay_type = #{payType} </if> <if test="receivedMarket != null and receivedMarket.length()>0"> and cr.received_market = #{receivedMarket} </if> <if test="refundModel != null and refundModel.length()>0"> and cr.refundModel = #{refundModel} </if> <if test="startTime != null and endTime != null"> and cr.`pay_time` BETWEEN #{startTime} AND #{endTime} </if> <if test=" submitterId!= null"> and cr.submitter_id = #{submitterId} </if> <if test="refundCurrency != null and refundCurrency.length()>0"> and cr.refund_currency = #{refundCurrency} </if> <if test="refundChannels != null and refundChannels.length()>0"> and cr.refund_channels = #{refundChannels} </if> <if test="sTime != null and eTime != null"> and cr.`refund_time` BETWEEN #{sTime} AND #{eTime} </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 create_time DESC </otherwise> </choose> </select></mapper>
|