update 部分sql适配

This commit is contained in:
yyb
2026-01-21 16:46:50 +08:00
parent fa7b07817c
commit b5931e81d4
8 changed files with 435 additions and 114 deletions

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.m2pool.lease.dto.OrderStatusDto; import com.m2pool.lease.dto.OrderStatusDto;
import com.m2pool.lease.dto.v2.OrderTimeInfoDto; import com.m2pool.lease.dto.v2.OrderTimeInfoDto;
import com.m2pool.lease.entity.LeaseOrderItem; import com.m2pool.lease.entity.LeaseOrderItem;
import com.m2pool.lease.entity.LeasePayRecordMessage;
import com.m2pool.lease.entity.LeasePaymentRecord; import com.m2pool.lease.entity.LeasePaymentRecord;
import com.m2pool.lease.entity.LeaseShopConfig; import com.m2pool.lease.entity.LeaseShopConfig;
import com.m2pool.lease.mq.message.RabbitmqPayAutoReturnInfoMessage; import com.m2pool.lease.mq.message.RabbitmqPayAutoReturnInfoMessage;
@@ -88,4 +89,11 @@ public interface LeaseOrderItemMapper extends BaseMapper<LeaseOrderItem> {
*/ */
long checkShopExistRunningOrderNumbers(@Param("list") List<LeaseShopConfig> list); long checkShopExistRunningOrderNumbers(@Param("list") List<LeaseShopConfig> list);
/**
* 批量更新订单详情的已实际支付金额
* @param reocrdList
* @return
*/
int updateSettleAmount(@Param("list") List<LeasePayRecordMessage> reocrdList);
} }

View File

@@ -77,61 +77,152 @@
</select> </select>
<select id="getShopMachineList" resultType="com.m2pool.lease.dto.v2.MachineInfoDto"> <select id="getShopMachineList" resultType="com.m2pool.lease.dto.v2.MachineInfoDto">
<!-- SELECT-->
<!-- sub.id,-->
<!-- sub.host_mac AS hostMac,-->
<!-- sub.shop_id as shopId,-->
<!-- sub.type,-->
<!-- sub.`user`,-->
<!-- sub.miner,-->
<!-- sub.state,-->
<!-- sub.sale_state AS saleState,-->
<!-- sub.max_lease_days AS maxLeaseDays,-->
<!-- sub.del,-->
<!-- sub.power_dissipation as powerDissipation,-->
<!-- sub.hashrate as theoryPower,-->
<!-- sub.unit,-->
<!-- sub.coin,-->
<!-- sub.month_income as monthIncome,-->
<!-- sub.name as model,-->
<!-- sub.algorithm,-->
<!-- sub.online_status AS onlineStatus,-->
<!-- sub.sale_numbers as saleNumbers,-->
<!-- sub.sale_out_numbers as saleOutNumbers,-->
<!-- mp.price-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- lm.id,-->
<!-- lm.host_mac,-->
<!-- lm.shop_id,-->
<!-- lm.type,-->
<!-- lm.`user`,-->
<!-- lm.miner,-->
<!-- lm.state,-->
<!-- lm.sale_state,-->
<!-- lm.max_lease_days,-->
<!-- lm.del,-->
<!-- lm.online_status,-->
<!-- lm.sale_numbers,-->
<!-- lm.sale_out_numbers,-->
<!-- SUM(gpc.power_dissipation) AS power_dissipation,-->
<!-- SUM(gpc.hashrate) AS hashrate,-->
<!-- SUM(gpc.month_income) AS month_income,-->
<!-- gpc.unit,-->
<!-- gpc.coin,-->
<!-- gpc.name,-->
<!-- gpc.algorithm,-->
<!-- ROW_NUMBER() OVER (-->
<!-- PARTITION BY lm.id-->
<!-- ORDER BY SUM(gpc.month_income) DESC-->
<!-- ) AS rn-->
<!-- FROM-->
<!-- lease_machine lm-->
<!-- JOIN-->
<!-- lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 AND lm.state = 0-->
<!-- GROUP BY lm.id,gpc.coin,gpc.algorithm-->
<!-- ) sub-->
<!-- LEFT JOIN lease_machine_price mp-->
<!-- ON sub.id = mp.machine_id AND mp.coin = #{shopMachineVo.coin} AND mp.chain = #{shopMachineVo.chain} AND mp.del = false AND sub.rn = 1-->
<!-- WHERE-->
<!-- sub.del = FALSE AND sub.rn = 1-->
<!-- <if test="shopMachineVo.minPrice != 0 or shopMachineVo.maxPrice != 0">-->
<!-- AND mp.price >= #{shopMachineVo.minPrice} AND mp.price <![CDATA[<=]]> #{shopMachineVo.maxPrice}-->
<!-- </if>-->
<!-- <if test="shopMachineVo.keyword != null and shopMachineVo.keyword != ''">-->
<!-- AND (sub.coin LIKE CONCAT('%', #{shopMachineVo.keyword}, '%') OR sub.algorithm LIKE CONCAT('%', #{shopMachineVo.keyword}, '%'))-->
<!-- </if>-->
-- 开发环境
SELECT SELECT
sub.id, sub.id,
sub.host_mac AS hostMac, sub.host_mac AS hostMac,
sub.shop_id as shopId, sub.shop_id as shopId,
sub.type, sub.type,
sub.`user`, sub.`user`,
sub.miner, sub.miner,
sub.state, sub.state,
sub.sale_state AS saleState, sub.sale_state AS saleState,
sub.max_lease_days AS maxLeaseDays, sub.max_lease_days AS maxLeaseDays,
sub.del, sub.del,
sub.power_dissipation as powerDissipation, sub.power_dissipation as powerDissipation,
sub.hashrate as theoryPower, sub.hashrate as theoryPower,
sub.unit, sub.unit,
sub.coin, sub.coin,
sub.month_income as monthIncome, sub.month_income as monthIncome,
sub.name as model, sub.name as model,
sub.algorithm, sub.algorithm,
sub.online_status AS onlineStatus, sub.online_status AS onlineStatus,
sub.sale_numbers as saleNumbers, sub.sale_numbers as saleNumbers,
sub.sale_out_numbers as saleOutNumbers, sub.sale_out_numbers as saleOutNumbers,
mp.price mp.price
FROM FROM
( (
SELECT SELECT
lm.id, t.id,
lm.host_mac, t.host_mac,
lm.shop_id, t.shop_id,
lm.type, t.type,
lm.`user`, t.`user`,
lm.miner, t.miner,
lm.state, t.state,
lm.sale_state, t.sale_state,
lm.max_lease_days, t.max_lease_days,
lm.del, t.del,
lm.online_status, t.online_status,
lm.sale_numbers, t.sale_numbers,
lm.sale_out_numbers, t.sale_out_numbers,
SUM(gpc.power_dissipation) AS power_dissipation, t.power_dissipation,
SUM(gpc.hashrate) AS hashrate, t.hashrate,
SUM(gpc.month_income) AS month_income, t.month_income,
gpc.unit, t.unit,
gpc.coin, t.coin,
gpc.name, t.name,
gpc.algorithm, t.algorithm,
ROW_NUMBER() OVER ( @rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn,
PARTITION BY lm.id @prev_id := t.id
ORDER BY SUM(gpc.month_income) DESC FROM
) AS rn (
FROM SELECT
lease_machine lm lm.id,
JOIN lm.host_mac,
lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 AND lm.state = 0 lm.shop_id,
GROUP BY lm.id,gpc.coin,gpc.algorithm lm.type,
) sub lm.`user`,
lm.miner,
lm.state,
lm.sale_state,
lm.max_lease_days,
lm.del,
lm.online_status,
lm.sale_numbers,
lm.sale_out_numbers,
SUM(gpc.power_dissipation) AS power_dissipation,
SUM(gpc.hashrate) AS hashrate,
SUM(gpc.month_income) AS month_income,
gpc.unit,
gpc.coin,
gpc.name,
gpc.algorithm
FROM
lease_machine lm
JOIN
lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 AND lm.state = 0
GROUP BY lm.id,gpc.coin,gpc.algorithm,gpc.name,gpc.unit
ORDER BY lm.id, SUM(gpc.month_income) DESC
) t,
(SELECT @rn := 0, @prev_id := 0) r
) sub
LEFT JOIN lease_machine_price mp LEFT JOIN lease_machine_price mp
ON sub.id = mp.machine_id AND mp.coin = #{shopMachineVo.coin} AND mp.chain = #{shopMachineVo.chain} AND mp.del = false AND sub.rn = 1 ON sub.id = mp.machine_id AND mp.coin = #{shopMachineVo.coin} AND mp.chain = #{shopMachineVo.chain} AND mp.del = false AND sub.rn = 1
WHERE WHERE
@@ -161,7 +252,7 @@
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
group by machine_id,coin, algorithm group by machine_id,coin, algorithm,unit
</select> </select>
<select id="getShopMachineListForSeller" resultType="com.m2pool.lease.dto.v2.SellerMachineInfoDto"> <select id="getShopMachineListForSeller" resultType="com.m2pool.lease.dto.v2.SellerMachineInfoDto">
@@ -188,6 +279,30 @@
FROM FROM
( (
SELECT SELECT
t.id,
t.shop_id,
t.type,
t.`user`,
t.miner,
t.state,
t.sale_state,
t.max_lease_days,
t.del,
t.online_status,
t.sale_numbers,
t.sale_out_numbers,
t.power_dissipation,
t.hashrate,
t.unit,
t.coin,
t.month_income,
t.name,
t.algorithm,
@rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn,
@prev_id := t.id
FROM
(
SELECT
lm.id, lm.id,
lm.shop_id, lm.shop_id,
lm.type, lm.type,
@@ -206,12 +321,14 @@
gpc.coin, gpc.coin,
gpc.month_income, gpc.month_income,
gpc.name, gpc.name,
gpc.algorithm, gpc.algorithm
ROW_NUMBER() OVER (PARTITION BY lm.id ORDER BY gpc.month_income DESC) as rn
FROM FROM
lease_machine lm lease_machine lm
JOIN JOIN
lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{sellerMachineVo.type} AND lm.shop_id = #{shopId} lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{sellerMachineVo.type} AND lm.shop_id = #{shopId}
ORDER BY lm.id, gpc.month_income DESC
) t,
(SELECT @rn := 0, @prev_id := 0) r
) sub ) sub
where where
sub.del = false and sub.rn = 1 sub.del = false and sub.rn = 1
@@ -221,6 +338,64 @@
<if test="sellerMachineVo.keyword != null and sellerMachineVo.keyword != ''"> <if test="sellerMachineVo.keyword != null and sellerMachineVo.keyword != ''">
AND sub.name LIKE CONCAT('%', #{sellerMachineVo.keyword}, '%') AND sub.name LIKE CONCAT('%', #{sellerMachineVo.keyword}, '%')
</if> </if>
-- 开发环境
<!-- SELECT-->
<!-- sub.id,-->
<!-- sub.shop_id as shopId,-->
<!-- sub.type,-->
<!-- sub.`user`,-->
<!-- sub.miner,-->
<!-- sub.state,-->
<!-- sub.sale_state AS saleState,-->
<!-- sub.max_lease_days AS maxLeaseDays,-->
<!-- sub.del,-->
<!-- sub.power_dissipation as powerDissipation,-->
<!-- sub.hashrate as theoryPower,-->
<!-- sub.unit,-->
<!-- sub.coin,-->
<!-- sub.month_income as monthIncome,-->
<!-- sub.name,-->
<!-- sub.algorithm,-->
<!-- sub.online_status AS onlineStatus,-->
<!-- sub.sale_numbers as saleNumbers,-->
<!-- sub.sale_out_numbers as saleOutNumbers-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- lm.id,-->
<!-- lm.shop_id,-->
<!-- lm.type,-->
<!-- lm.`user`,-->
<!-- lm.miner,-->
<!-- lm.state,-->
<!-- lm.sale_state,-->
<!-- lm.max_lease_days,-->
<!-- lm.del,-->
<!-- lm.online_status,-->
<!-- lm.sale_numbers,-->
<!-- lm.sale_out_numbers,-->
<!-- gpc.power_dissipation,-->
<!-- gpc.hashrate,-->
<!-- gpc.unit,-->
<!-- gpc.coin,-->
<!-- gpc.month_income,-->
<!-- gpc.name,-->
<!-- gpc.algorithm,-->
<!-- ROW_NUMBER() OVER (PARTITION BY lm.id ORDER BY gpc.month_income DESC) as rn-->
<!-- FROM-->
<!-- lease_machine lm-->
<!-- JOIN-->
<!-- lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{sellerMachineVo.type} AND lm.shop_id = #{shopId}-->
<!-- ) sub-->
<!-- where-->
<!-- sub.del = false and sub.rn = 1-->
<!-- <if test="sellerMachineVo.name != null and sellerMachineVo.name != ''">-->
<!-- AND sub.name LIKE CONCAT('%', #{sellerMachineVo.name}, '%')-->
<!-- </if>-->
<!-- <if test="sellerMachineVo.keyword != null and sellerMachineVo.keyword != ''">-->
<!-- AND sub.name LIKE CONCAT('%', #{sellerMachineVo.keyword}, '%')-->
<!-- </if>-->
</select> </select>
@@ -256,56 +431,81 @@
FROM FROM
( (
SELECT SELECT
sub.id, t.id,
sub.shop_id AS shopId, t.shop_id AS shopId,
sub.type, t.type,
sub.`user`, t.`user`,
sub.miner, t.miner,
sub.state, t.state,
sub.sale_state AS saleState, t.sale_state AS saleState,
sub.max_lease_days AS maxLeaseDays, t.max_lease_days AS maxLeaseDays,
sub.del, t.del,
sub.power_dissipation AS powerDissipation, t.power_dissipation AS powerDissipation,
sub.hashrate AS power, t.hashrate AS power,
sub.unit, t.unit,
sub.coin, t.coin,
sub.month_income AS monthIncome, t.month_income AS monthIncome,
sub.NAME, t.NAME,
sub.online_status AS onlineStatus, t.online_status AS onlineStatus,
sub.can_sale_numbers as canSaleNumbers, t.can_sale_numbers as canSaleNumbers,
sub.algorithm, t.algorithm,
ci.id AS cartInfoId, t.cartInfoId,
ci.numbers, t.numbers,
ci.lease_time AS leaseTime, t.lease_time AS leaseTime,
ROW_NUMBER() OVER ( PARTITION BY sub.id ORDER BY sub.month_income DESC ) AS rn @rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn,
@prev_id := t.id
FROM FROM
( (
SELECT SELECT
lm.id, sub.id,
lm.shop_id, sub.shop_id ,
lm.type, sub.type,
lm.`user`, sub.`user`,
lm.miner, sub.miner,
lm.state, sub.state,
lm.sale_state, sub.sale_state ,
lm.max_lease_days, sub.max_lease_days ,
lm.del, sub.del,
lm.online_status, sub.power_dissipation ,
lm.can_sale_numbers, sub.hashrate ,
gpc.power_dissipation AS power_dissipation, sub.unit,
gpc.hashrate, sub.coin,
gpc.month_income AS month_income, sub.month_income,
gpc.unit, sub.NAME,
gpc.coin, sub.online_status ,
gpc.NAME, sub.can_sale_numbers ,
gpc.algorithm sub.algorithm,
ci.id AS cartInfoId,
ci.numbers,
ci.lease_time AS lease_time
FROM FROM
lease_machine lm (
JOIN lease_machine_config gpc ON lm.id = gpc.machine_id AND gpc.status = 1 SELECT
GROUP BY lm.id,
lm.id, lm.shop_id,
gpc.coin, lm.type,
gpc.`algorithm` lm.`user`,
lm.miner,
lm.state,
lm.sale_state,
lm.max_lease_days,
lm.del,
lm.online_status,
lm.can_sale_numbers,
gpc.power_dissipation AS power_dissipation,
gpc.hashrate,
gpc.month_income AS month_income,
gpc.unit,
gpc.coin,
gpc.name,
gpc.algorithm
FROM
lease_machine lm
JOIN lease_machine_config gpc ON lm.id = gpc.machine_id AND gpc.status = 1
GROUP BY
lm.id,
gpc.coin,
gpc.`algorithm`,gpc.power_dissipation,gpc.hashrate,gpc.month_income, gpc.unit, gpc.name
) sub ) sub
JOIN lease_shopping_cart_info ci ON sub.id = ci.product_machine_id AND ci.user_id = #{userId} JOIN lease_shopping_cart_info ci ON sub.id = ci.product_machine_id AND ci.user_id = #{userId}
AND ci.version = 1 AND ci.version = 1
@@ -314,9 +514,80 @@
<foreach collection="machineIds" item="machineId" open="(" separator="," close=")"> <foreach collection="machineIds" item="machineId" open="(" separator="," close=")">
#{machineId} #{machineId}
</foreach> </foreach>
ORDER BY sub.id, sub.month_income DESC
) t,
(SELECT @rn := 0, @prev_id := 0) r
) t ) t
WHERE WHERE
rn = 1 rn = 1
-- 开发环境
<!-- SELECT-->
<!-- *-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- sub.id,-->
<!-- sub.shop_id AS shopId,-->
<!-- sub.type,-->
<!-- sub.`user`,-->
<!-- sub.miner,-->
<!-- sub.state,-->
<!-- sub.sale_state AS saleState,-->
<!-- sub.max_lease_days AS maxLeaseDays,-->
<!-- sub.del,-->
<!-- sub.power_dissipation AS powerDissipation,-->
<!-- sub.hashrate AS power,-->
<!-- sub.unit,-->
<!-- sub.coin,-->
<!-- sub.month_income AS monthIncome,-->
<!-- sub.NAME,-->
<!-- sub.online_status AS onlineStatus,-->
<!-- sub.can_sale_numbers as canSaleNumbers,-->
<!-- sub.algorithm,-->
<!-- ci.id AS cartInfoId,-->
<!-- ci.numbers,-->
<!-- ci.lease_time AS leaseTime,-->
<!-- ROW_NUMBER() OVER ( PARTITION BY sub.id ORDER BY sub.month_income DESC ) AS rn-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- lm.id,-->
<!-- lm.shop_id,-->
<!-- lm.type,-->
<!-- lm.`user`,-->
<!-- lm.miner,-->
<!-- lm.state,-->
<!-- lm.sale_state,-->
<!-- lm.max_lease_days,-->
<!-- lm.del,-->
<!-- lm.online_status,-->
<!-- lm.can_sale_numbers,-->
<!-- gpc.power_dissipation AS power_dissipation,-->
<!-- gpc.hashrate,-->
<!-- gpc.month_income AS month_income,-->
<!-- gpc.unit,-->
<!-- gpc.coin,-->
<!-- gpc.NAME,-->
<!-- gpc.algorithm-->
<!-- FROM-->
<!-- lease_machine lm-->
<!-- JOIN lease_machine_config gpc ON lm.id = gpc.machine_id AND gpc.status = 1-->
<!-- GROUP BY-->
<!-- lm.id,-->
<!-- gpc.coin,-->
<!-- gpc.`algorithm`-->
<!-- ) sub-->
<!-- JOIN lease_shopping_cart_info ci ON sub.id = ci.product_machine_id AND ci.user_id = #{userId}-->
<!-- AND ci.version = 1-->
<!-- WHERE-->
<!-- sub.id IN-->
<!-- <foreach collection="machineIds" item="machineId" open="(" separator="," close=")">-->
<!-- #{machineId}-->
<!-- </foreach>-->
<!-- ) t-->
<!-- WHERE-->
<!-- rn = 1-->
</select> </select>
<select id="getCoinAndAlgoList" resultType="com.m2pool.lease.dto.v2.AsicCoinAndAlgoDto"> <select id="getCoinAndAlgoList" resultType="com.m2pool.lease.dto.v2.AsicCoinAndAlgoDto">
select select

View File

@@ -22,6 +22,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, order_id, product_id,product_machine_id,`name`, unit, image, quantity, price, create_time, update_time, del id, order_id, product_id,product_machine_id,`name`, unit, image, quantity, price, create_time, update_time, del
</sql> </sql>
<select id="getMachineByOrderStatusIsPayInData" resultType="java.lang.Long"> <select id="getMachineByOrderStatusIsPayInData" resultType="java.lang.Long">
select product_machine_id AS productMachineId from lease_order_item select product_machine_id AS productMachineId from lease_order_item
where where
@@ -127,5 +128,14 @@
) )
</select> </select>
<update id="updateSettleAmount">
UPDATE lease_order_item
SET already_pay_real_amount = settle_pay_real_amount,settle_pay_real_amount = 0
WHERE order_id IN (
<foreach collection="list" item="item" separator=",">
#{item.orderId}
</foreach>
)
</update>
</mapper> </mapper>

View File

@@ -103,11 +103,17 @@
t.miner t.miner
FROM ( FROM (
SELECT SELECT
datetime, sub.datetime,
hashrate, sub.hashrate,
miner, sub.miner,
ROW_NUMBER() OVER(PARTITION BY miner ORDER BY datetime DESC) as rn @rn := IF(@prev_miner = sub.miner, @rn + 1, 1) AS rn,
FROM `${pool}` @prev_miner := sub.miner
FROM (
SELECT
datetime,
hashrate,
miner
FROM `${pool}`
WHERE wallet = #{wallet} WHERE wallet = #{wallet}
AND coin = #{coin} AND coin = #{coin}
AND miner IN ( AND miner IN (
@@ -115,8 +121,33 @@
#{item.workerId} #{item.workerId}
</foreach> </foreach>
) )
ORDER BY miner, datetime DESC
) sub,
(SELECT @rn := 0, @prev_miner := '') r
) t ) t
WHERE t.rn = 1 WHERE t.rn = 1
-- 开发环境
<!-- SELECT-->
<!-- t.datetime AS recordTime,-->
<!-- t.hashrate AS power,-->
<!-- t.miner-->
<!-- FROM (-->
<!-- SELECT-->
<!-- datetime,-->
<!-- hashrate,-->
<!-- miner,-->
<!-- ROW_NUMBER() OVER(PARTITION BY miner ORDER BY datetime DESC) as rn-->
<!-- FROM `${pool}`-->
<!-- WHERE wallet = #{wallet}-->
<!-- AND coin = #{coin}-->
<!-- AND miner IN (-->
<!-- <foreach collection="list" item="item" separator=",">-->
<!-- #{item.workerId}-->
<!-- </foreach>-->
<!-- )-->
<!-- ) t-->
<!-- WHERE t.rn = 1-->
</select> </select>
<select id="getRecently24HourHashrate" resultType="com.m2pool.lease.dto.v2.RealHashrateInfoDto"> <select id="getRecently24HourHashrate" resultType="com.m2pool.lease.dto.v2.RealHashrateInfoDto">
SELECT SELECT
@@ -164,8 +195,7 @@
WHERE status = 1 AND ( WHERE status = 1 AND (
<foreach collection="list" item="item" separator="OR"> <foreach collection="list" item="item" separator="OR">
(`wallet_address` = #{item.walletAddress} AND worker_id = #{item.workerId} ) (`wallet_address` = #{item.walletAddress} AND worker_id = #{item.workerId} )
</foreach> </foreach>)
)
</select> </select>
<select id="getPurchasedMachineInfo" resultType="com.m2pool.lease.dto.v2.PurchasedMachineDto"> <select id="getPurchasedMachineInfo" resultType="com.m2pool.lease.dto.v2.PurchasedMachineDto">
select select

View File

@@ -63,7 +63,7 @@ from lease_pay_recharge_message
select select
amount as amount, amount as amount,
update_time as updateTime, update_time as updateTime,
1 as type,status 1 as type,status,symbol as coin
from lease_pay_recharge_message from lease_pay_recharge_message
<where> <where>
(<foreach collection="walletList" item="item" separator="OR"> (<foreach collection="walletList" item="item" separator="OR">

View File

@@ -108,10 +108,11 @@
</select> </select>
<select id="getRecentlyTransaction" resultType="com.m2pool.lease.dto.RecentlyTransactionDto"> <select id="getRecentlyTransaction" resultType="com.m2pool.lease.dto.RecentlyTransactionDto">
select select
case when real_amount = 0 then amount else real_amount end as amount, real_amount as amount,
update_time as updateTime, update_time as updateTime,
0 as type, 0 as type,
status status,
from_symbol as coin
from lease_pay_record_message from lease_pay_record_message
<where> <where>
(<foreach collection="walletList" item="item" separator="OR"> (<foreach collection="walletList" item="item" separator="OR">

View File

@@ -96,7 +96,8 @@ FROM lease_pay_withdraw_message
amount as amount, amount as amount,
update_time as updateTime, update_time as updateTime,
2 as type, 2 as type,
status status,
from_symbol as coin
from lease_pay_withdraw_message from lease_pay_withdraw_message
<where> <where>
(<foreach collection="walletList" item="item" separator="OR"> (<foreach collection="walletList" item="item" separator="OR">

View File

@@ -93,14 +93,14 @@
UPDATE lease_shop_config UPDATE lease_shop_config
SET balance = CASE SET balance = CASE
<foreach collection="list" item="item"> <foreach collection="list" item="item">
WHEN pay_address = #{item.fromAddress} AND pay_coin = #{item.fromSymbol} AND chain = #{item.fromChain} AND del = false WHEN pay_address = #{item.toAddress} AND pay_coin = #{item.fromSymbol} AND chain = #{item.fromChain} AND del = false
THEN balance + #{item.realAmount} THEN balance + #{item.realAmount}
</foreach> </foreach>
ELSE balance ELSE balance
END END
WHERE (pay_address,pay_coin,chain) IN( WHERE (pay_address,pay_coin,chain) IN(
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.fromAddress}, #{item.fromSymbol}, #{item.fromChain}) (#{item.toAddress}, #{item.fromSymbol}, #{item.fromChain})
</foreach> </foreach>
) AND del = false ) AND del = false