update 部分sql适配
This commit is contained in:
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.m2pool.lease.dto.OrderStatusDto;
|
||||
import com.m2pool.lease.dto.v2.OrderTimeInfoDto;
|
||||
import com.m2pool.lease.entity.LeaseOrderItem;
|
||||
import com.m2pool.lease.entity.LeasePayRecordMessage;
|
||||
import com.m2pool.lease.entity.LeasePaymentRecord;
|
||||
import com.m2pool.lease.entity.LeaseShopConfig;
|
||||
import com.m2pool.lease.mq.message.RabbitmqPayAutoReturnInfoMessage;
|
||||
@@ -88,4 +89,11 @@ public interface LeaseOrderItemMapper extends BaseMapper<LeaseOrderItem> {
|
||||
*/
|
||||
long checkShopExistRunningOrderNumbers(@Param("list") List<LeaseShopConfig> list);
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新订单详情的已实际支付金额
|
||||
* @param reocrdList
|
||||
* @return
|
||||
*/
|
||||
int updateSettleAmount(@Param("list") List<LeasePayRecordMessage> reocrdList);
|
||||
}
|
||||
|
||||
@@ -77,61 +77,152 @@
|
||||
</select>
|
||||
|
||||
<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
|
||||
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
|
||||
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
|
||||
SELECT
|
||||
t.id,
|
||||
t.host_mac,
|
||||
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.month_income,
|
||||
t.unit,
|
||||
t.coin,
|
||||
t.name,
|
||||
t.algorithm,
|
||||
@rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn,
|
||||
@prev_id := t.id
|
||||
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
|
||||
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
|
||||
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
|
||||
@@ -161,7 +252,7 @@
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
group by machine_id,coin, algorithm
|
||||
group by machine_id,coin, algorithm,unit
|
||||
</select>
|
||||
|
||||
<select id="getShopMachineListForSeller" resultType="com.m2pool.lease.dto.v2.SellerMachineInfoDto">
|
||||
@@ -188,6 +279,30 @@
|
||||
FROM
|
||||
(
|
||||
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.shop_id,
|
||||
lm.type,
|
||||
@@ -206,12 +321,14 @@
|
||||
gpc.coin,
|
||||
gpc.month_income,
|
||||
gpc.name,
|
||||
gpc.algorithm,
|
||||
ROW_NUMBER() OVER (PARTITION BY lm.id ORDER BY gpc.month_income DESC) as rn
|
||||
gpc.algorithm
|
||||
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}
|
||||
ORDER BY lm.id, gpc.month_income DESC
|
||||
) t,
|
||||
(SELECT @rn := 0, @prev_id := 0) r
|
||||
) sub
|
||||
where
|
||||
sub.del = false and sub.rn = 1
|
||||
@@ -221,6 +338,64 @@
|
||||
<if test="sellerMachineVo.keyword != null and sellerMachineVo.keyword != ''">
|
||||
AND sub.name LIKE CONCAT('%', #{sellerMachineVo.keyword}, '%')
|
||||
</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>
|
||||
|
||||
|
||||
@@ -256,56 +431,81 @@
|
||||
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
|
||||
t.id,
|
||||
t.shop_id AS shopId,
|
||||
t.type,
|
||||
t.`user`,
|
||||
t.miner,
|
||||
t.state,
|
||||
t.sale_state AS saleState,
|
||||
t.max_lease_days AS maxLeaseDays,
|
||||
t.del,
|
||||
t.power_dissipation AS powerDissipation,
|
||||
t.hashrate AS power,
|
||||
t.unit,
|
||||
t.coin,
|
||||
t.month_income AS monthIncome,
|
||||
t.NAME,
|
||||
t.online_status AS onlineStatus,
|
||||
t.can_sale_numbers as canSaleNumbers,
|
||||
t.algorithm,
|
||||
t.cartInfoId,
|
||||
t.numbers,
|
||||
t.lease_time AS leaseTime,
|
||||
@rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn,
|
||||
@prev_id := t.id
|
||||
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
|
||||
sub.id,
|
||||
sub.shop_id ,
|
||||
sub.type,
|
||||
sub.`user`,
|
||||
sub.miner,
|
||||
sub.state,
|
||||
sub.sale_state ,
|
||||
sub.max_lease_days ,
|
||||
sub.del,
|
||||
sub.power_dissipation ,
|
||||
sub.hashrate ,
|
||||
sub.unit,
|
||||
sub.coin,
|
||||
sub.month_income,
|
||||
sub.NAME,
|
||||
sub.online_status ,
|
||||
sub.can_sale_numbers ,
|
||||
sub.algorithm,
|
||||
ci.id AS cartInfoId,
|
||||
ci.numbers,
|
||||
ci.lease_time AS lease_time
|
||||
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`
|
||||
(
|
||||
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`,gpc.power_dissipation,gpc.hashrate,gpc.month_income, gpc.unit, gpc.name
|
||||
) sub
|
||||
JOIN lease_shopping_cart_info ci ON sub.id = ci.product_machine_id AND ci.user_id = #{userId}
|
||||
AND ci.version = 1
|
||||
@@ -314,9 +514,80 @@
|
||||
<foreach collection="machineIds" item="machineId" open="(" separator="," close=")">
|
||||
#{machineId}
|
||||
</foreach>
|
||||
ORDER BY sub.id, sub.month_income DESC
|
||||
) t,
|
||||
(SELECT @rn := 0, @prev_id := 0) r
|
||||
) t
|
||||
WHERE
|
||||
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 id="getCoinAndAlgoList" resultType="com.m2pool.lease.dto.v2.AsicCoinAndAlgoDto">
|
||||
select
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
id, order_id, product_id,product_machine_id,`name`, unit, image, quantity, price, create_time, update_time, del
|
||||
</sql>
|
||||
|
||||
<select id="getMachineByOrderStatusIsPayInData" resultType="java.lang.Long">
|
||||
select product_machine_id AS productMachineId from lease_order_item
|
||||
where
|
||||
@@ -127,5 +128,14 @@
|
||||
)
|
||||
</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>
|
||||
|
||||
@@ -103,11 +103,17 @@
|
||||
t.miner
|
||||
FROM (
|
||||
SELECT
|
||||
datetime,
|
||||
hashrate,
|
||||
miner,
|
||||
ROW_NUMBER() OVER(PARTITION BY miner ORDER BY datetime DESC) as rn
|
||||
FROM `${pool}`
|
||||
sub.datetime,
|
||||
sub.hashrate,
|
||||
sub.miner,
|
||||
@rn := IF(@prev_miner = sub.miner, @rn + 1, 1) AS rn,
|
||||
@prev_miner := sub.miner
|
||||
FROM (
|
||||
SELECT
|
||||
datetime,
|
||||
hashrate,
|
||||
miner
|
||||
FROM `${pool}`
|
||||
WHERE wallet = #{wallet}
|
||||
AND coin = #{coin}
|
||||
AND miner IN (
|
||||
@@ -115,8 +121,33 @@
|
||||
#{item.workerId}
|
||||
</foreach>
|
||||
)
|
||||
ORDER BY miner, datetime DESC
|
||||
) sub,
|
||||
(SELECT @rn := 0, @prev_miner := '') r
|
||||
) t
|
||||
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 id="getRecently24HourHashrate" resultType="com.m2pool.lease.dto.v2.RealHashrateInfoDto">
|
||||
SELECT
|
||||
@@ -164,8 +195,7 @@
|
||||
WHERE status = 1 AND (
|
||||
<foreach collection="list" item="item" separator="OR">
|
||||
(`wallet_address` = #{item.walletAddress} AND worker_id = #{item.workerId} )
|
||||
</foreach>
|
||||
)
|
||||
</foreach>)
|
||||
</select>
|
||||
<select id="getPurchasedMachineInfo" resultType="com.m2pool.lease.dto.v2.PurchasedMachineDto">
|
||||
select
|
||||
|
||||
@@ -63,7 +63,7 @@ from lease_pay_recharge_message
|
||||
select
|
||||
amount as amount,
|
||||
update_time as updateTime,
|
||||
1 as type,status
|
||||
1 as type,status,symbol as coin
|
||||
from lease_pay_recharge_message
|
||||
<where>
|
||||
(<foreach collection="walletList" item="item" separator="OR">
|
||||
|
||||
@@ -108,10 +108,11 @@
|
||||
</select>
|
||||
<select id="getRecentlyTransaction" resultType="com.m2pool.lease.dto.RecentlyTransactionDto">
|
||||
select
|
||||
case when real_amount = 0 then amount else real_amount end as amount,
|
||||
real_amount as amount,
|
||||
update_time as updateTime,
|
||||
0 as type,
|
||||
status
|
||||
status,
|
||||
from_symbol as coin
|
||||
from lease_pay_record_message
|
||||
<where>
|
||||
(<foreach collection="walletList" item="item" separator="OR">
|
||||
|
||||
@@ -96,7 +96,8 @@ FROM lease_pay_withdraw_message
|
||||
amount as amount,
|
||||
update_time as updateTime,
|
||||
2 as type,
|
||||
status
|
||||
status,
|
||||
from_symbol as coin
|
||||
from lease_pay_withdraw_message
|
||||
<where>
|
||||
(<foreach collection="walletList" item="item" separator="OR">
|
||||
|
||||
@@ -93,14 +93,14 @@
|
||||
UPDATE lease_shop_config
|
||||
SET balance = CASE
|
||||
<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}
|
||||
</foreach>
|
||||
ELSE balance
|
||||
END
|
||||
WHERE (pay_address,pay_coin,chain) IN(
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.fromAddress}, #{item.fromSymbol}, #{item.fromChain})
|
||||
(#{item.toAddress}, #{item.fromSymbol}, #{item.fromChain})
|
||||
</foreach>
|
||||
) AND del = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user