Browse Source

11-11 收款sql优化

sunjiabei/feature-20251021102635-银行接口
lijianlin 2 weeks ago
parent
commit
060b0e71bb
  1. 2
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  2. 4
      src/main/resources/cashMapper/CashAuditMapper.xml
  3. 21
      src/main/resources/cashMapper/CashCollectionMapper.xml

2
src/main/java/com/example/demo/controller/cash/CashCollectionController.java

@ -68,7 +68,7 @@ public class CashCollectionController {
}
//撤回未审核的收款订单
@PostMapping("/cancel")
public Result cancel(@RequestBody CashRecord cashRecord) {
public Result cancel(@RequestBody CashCollection cashRecord) {
try {
return Result.success( cashCollectionService.cancel(cashRecord.getOrderCode()));

4
src/main/resources/cashMapper/CashAuditMapper.xml

@ -4,7 +4,7 @@
<!--审核收款订单-->
<update id="updateOrder">
update cash_record
update cash_record_collection
set status=#{status},
reject_reason=#{rejectReason},
audit_id=#{auditId},
@ -13,7 +13,7 @@
</update>
<select id="getAuditName" resultType="java.lang.String">
select a.admin_name from admin as a left join
cash_record cr on a.id=cr.audit_id
cash_record_collection cr on a.id=cr.audit_id
where a.id=#{auditId} limit 1
</select>
</mapper>

21
src/main/resources/cashMapper/CashCollectionMapper.xml

@ -12,7 +12,7 @@
pay_type,pay_time,status,submitter_id,submitter_market,
voucher,remark)
values(#{orderType},#{jwcode},#{name},#{market},#{activity},
#{orderCode},#{goodsName},#{goodNum},#{NumUnit},#{permanentGold},#{freeGold},#{paymentCurrency},
#{orderCode},#{goodsName},#{goodNum},#{numUnit},#{permanentGold},#{freeGold},#{paymentCurrency},
#{paymentAmount},#{receivedMarket},#{payType},#{payTime},
#{status},#{submitterId},#{submitterMarket},#{voucher},#{remark})
</insert>
@ -43,10 +43,9 @@
activity = #{cashRecordCollection.activity},
goods_name = #{cashRecordCollection.goodsName},
good_num = #{cashRecordCollection.goodNum},
num_unit = #{cashRecordCollection.NumUnit},
num_unit = #{cashRecordCollection.numUnit},
permanent_gold = #{cashRecordCollection.permanentGold},
free_gold = #{cashRecordCollection.freeGold},
Num_unit = #{cashRecordCollection.NumUnit},
payment_currency = #{cashRecordCollection.paymentCurrency},
payment_amount = #{cashRecordCollection.paymentAmount},
received_market = #{cashRecordCollection.receivedMarket},
@ -63,23 +62,23 @@
<update id="complete">
UPDATE cash_record_collection
<set>
<if test="cashRecord.handlingCharge != null ">
<if test="cashRecordCollection.handlingCharge != null ">
handling_charge = #{cashRecordCollection.handlingCharge},
</if>
<if test="cashRecord.receivedCurrency != null and cashRecord.receivedCurrency != ''">
<if test="cashRecordCollection.receivedCurrency != null and cashRecordCollection.receivedCurrency != ''">
received_currency = #{cashRecordCollection.receivedCurrency},
</if>
<if test="cashRecord.receivedAmount != null and cashRecord.receivedAmount != ''">
<if test="cashRecordCollection.receivedAmount != null and cashRecordCollection.receivedAmount != ''">
received_amount = #{cashRecordCollection.receivedAmount},
</if>
<if test="cashRecord.receivedTime != null">
<if test="cashRecordCollection.receivedTime != null">
received_time = #{cashRecordCollection.receivedTime},
</if>
<if test="cashRecord.paymentCurrency != null and cashRecord.paymentCurrency != ''">
<if test="cashRecordCollection.paymentCurrency != null and cashRecordCollection.paymentCurrency != ''">
payment_currency = #{cashRecordCollection.paymentCurrency},
</if>
<!-- 关键:null 就不拼这一列 -->
<if test="cashRecord.paymentAmount != null">
<if test="cashRecordCollection.paymentAmount != null">
payment_amount = #{cashRecordCollection.paymentAmount},
</if>
<!-- 只有 这些字段全部非空才更新状态 -->
@ -111,7 +110,7 @@
<!--根据订单号获取订单id与状态-->
<select id="selectByOrderCode" resultType="com.example.demo.domain.entity.CashRecord">
select id ,status
from cash_record
from cash_record_collection
where order_code=#{orderCode}
</select>
<!--多条件查询收款订单列表-->
@ -218,7 +217,7 @@
payment_currency,payment_amount,pay_type,pay_time,crc.status,submitter_id,
voucher,remark
from cash_record_collection crc
left join recharge_activity ra on ra.id = cash_record.activity
left join recharge_activity ra on ra.id = crc.activity
where order_code=#{orderCode}
</select>
<!--根据精网号获取姓名-->

Loading…
Cancel
Save