Bonus-Cloud-Houqin/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/v3/AccTradeMapper.xml

191 lines
7.1 KiB
XML
Raw Normal View History

2025-02-27 13:36:55 +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">
2025-02-27 13:46:27 +08:00
<mapper namespace="com.bonus.canteen.core.account.v3.mapper.AccTradeMapper">
2025-02-27 13:36:55 +08:00
<!-- 移动端分页查询充值记录 -->
2025-02-27 13:46:27 +08:00
<select id="queryTradeAppPage" resultType="com.bonus.canteen.core.account.v3.app.vo.AppAccTradePageVO">
2025-02-27 13:36:55 +08:00
SELECT
id AS tradeId,
amount,
acc_all_bal as walletBalTotal,
trade_type,
trade_time,
pay_state,
pay_type,
remark,
fail_reason
FROM acc_trade
<where>
cust_id = #{infoParam.custId}
<if test="infoParam.startDateTime != null">
and trade_time <![CDATA[ >= ]]> #{infoParam.startDateTime}
</if>
<if test="infoParam.endDateTime != null">
and trade_time <![CDATA[ <= ]]> #{infoParam.endDateTime}
</if>
<if test="infoParam.tradeTypeList != null and infoParam.tradeTypeList.size()>0 ">
and trade_type in
<foreach collection="infoParam.tradeTypeList" item="tradeType" separator="," open="(" close=")">
#{tradeType}
</foreach>
</if>
<if test="infoParam.payStateList != null and infoParam.payStateList.size()>0 ">
and pay_state in
<foreach collection="infoParam.payStateList" item="payState" separator="," open="(" close=")">
#{payState}
</foreach>
</if>
</where>
ORDER BY trade_time DESC
</select>
<!-- * 查询交易记录 场景发送mq-->
2025-02-27 13:46:27 +08:00
<select id="listAccTradeForSend" resultType="com.bonus.canteen.core.account.v3.mq.send.model.RepAccMqModel">
2025-02-27 13:36:55 +08:00
SELECT
atr.id AS flowId,
atr.cust_id,
ci.cust_num,
2025-03-12 16:22:41 +08:00
ci.nick_name as cust_name,
2025-02-27 13:36:55 +08:00
atr.org_id,
2025-03-12 16:22:41 +08:00
co.dept_name as org_name,
2025-03-14 16:46:49 +08:00
<!-- co.org_full_name, -->
2025-02-27 13:36:55 +08:00
atr.psn_type,
cpt.psn_type_name,
atr.amount AS flowAmount,
atr.actual_amount AS flowRealAmount,
atr.manage_cost AS manageCost,
atr.wallet_bal_total AS accTotalBal,
atr.acc_all_bal AS accAllBal,
atr.trade_time AS payTime,
atr.trade_type AS flowType,
atr.remark,
atr.crby AS optname,
atr.recharge_source AS rechargeSource,
atr.machine_type AS machineType,
atr.pay_channel AS payChannel,
atr.pay_type AS payType,
atr.batch_num AS batchNum,
atr.recharge_operate AS rechargeOperate,
atr.machine_sn As mchSn,
atr.machine_sn,
atr.withdraw_source,
atr.operate_source,
atr.origin_trade_id
FROM
acc_trade AS atr
2025-03-12 16:22:41 +08:00
LEFT JOIN sys_user AS ci ON atr.cust_id = ci.cust_id
LEFT JOIN sys_dept AS co ON atr.org_id = co.dept_id
2025-02-27 13:36:55 +08:00
LEFT JOIN cust_psn_type AS cpt ON atr.psn_type = cpt.psn_type
WHERE atr.id IN
<foreach collection="tradeIdList" item="tradeId" separator="," open="(" close=")">
#{tradeId}
</foreach>
ORDER BY atr.trade_time,atr.id
</select>
2025-03-12 16:22:41 +08:00
<!-- <select id="listAccTradeForSend" resultType="net.xnzn.core.account.v3.mq.send.model.RepAccMqModel">-->
<!-- SELECT-->
<!-- atr.id AS flowId,-->
<!-- atr.cust_id,-->
<!-- ci.cust_num,-->
<!-- ci.cust_name,-->
<!-- atr.org_id,-->
<!-- co.org_name,-->
<!-- co.org_full_name,-->
<!-- atr.psn_type,-->
<!-- cpt.psn_type_name,-->
<!-- atr.amount AS flowAmount,-->
<!-- atr.actual_amount AS flowRealAmount,-->
<!-- atr.manage_cost AS manageCost,-->
<!-- atr.wallet_bal_total AS accTotalBal,-->
<!-- atr.acc_all_bal AS accAllBal,-->
<!-- atr.trade_time AS payTime,-->
<!-- atr.trade_type AS flowType,-->
<!-- atr.remark,-->
<!-- atr.crby AS optname,-->
<!-- atr.recharge_source AS rechargeSource,-->
<!-- atr.machine_type AS machineType,-->
<!-- atr.pay_channel AS payChannel,-->
<!-- atr.pay_type AS payType,-->
<!-- atr.batch_num AS batchNum,-->
<!-- atr.recharge_operate AS rechargeOperate,-->
<!-- atr.machine_sn As mchSn,-->
<!-- atr.machine_sn,-->
<!-- atr.withdraw_source,-->
<!-- atr.operate_source,-->
<!-- atr.origin_trade_id-->
<!-- FROM-->
<!-- acc_trade AS atr-->
<!-- LEFT JOIN cust_info AS ci ON atr.cust_id = ci.cust_id-->
<!-- LEFT JOIN cust_org AS co ON atr.org_id = co.org_id-->
<!-- LEFT JOIN cust_psn_type AS cpt ON atr.psn_type = cpt.psn_type-->
<!-- WHERE atr.id IN-->
<!-- <foreach collection="tradeIdList" item="tradeId" separator="," open="(" close=")">-->
<!-- #{tradeId}-->
<!-- </foreach>-->
<!-- ORDER BY atr.trade_time,atr.id-->
<!-- </select>-->
2025-02-27 13:36:55 +08:00
<!-- 获取个人钱包充值汇总-->
2025-02-27 13:46:27 +08:00
<select id="getAccRechargeSum" resultType="com.bonus.canteen.core.account.v3.api.vo.AccRechargeSumApiVO">
2025-02-27 13:36:55 +08:00
SELECT
count(*) AS sumCount,
SUM( amount ) AS sumAmount
FROM
acc_trade t1
<where>
t1.trade_type = 10 and t1.pay_state = 3 and t1.trade_state = 2
<if test="param.custId != null">
and t1.cust_id = #{param.custId}
</if>
<if test="param.startDateTime != null">
and t1.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
</if>
<if test="param.endDateTime != null">
and t1.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
</if>
<if test="param.payChannellList != null and param.payChannellList.size() > 0">
and t1.pay_channel in
<foreach collection="param.payChannellList" item="payChannel" separator="," open="(" close=")">
#{payChannel}
</foreach>
</if>
</where>
</select>
<!-- 移动端根据交易id获取交易记录-->
2025-02-27 13:46:27 +08:00
<select id="getOneTradeApp" resultType="com.bonus.canteen.core.account.v3.app.vo.AppAccTradePageVO">
2025-02-27 13:36:55 +08:00
SELECT
id AS tradeId,
amount,
acc_all_bal as walletBalTotal,
trade_type,
trade_time,
pay_state,
pay_type,
remark
FROM acc_trade
WHERE id = #{tradeId}
</select>
<!-- 查询用户补贴交易明细-->
2025-02-27 13:46:27 +08:00
<select id="listAccSubsidyTrade" resultType="com.bonus.canteen.core.account.v3.model.AccTradeWalletDetail">
2025-02-27 13:36:55 +08:00
SELECT *
FROM
acc_trade_wallet_detail
<where>
wallet_id = 2
and cust_id = #{custId}
<if test="tradeTypeList != null and tradeTypeList.size() > 0">
and trade_type in
<foreach collection="tradeTypeList" item="tradeType" separator="," open="(" close=")">
#{tradeType}
</foreach>
</if>
</where>
ORDER BY trade_time DESC,trade_id DESC
</select>
</mapper>