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.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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,73 @@
|
|||||||
</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,
|
||||||
@@ -102,6 +169,31 @@
|
|||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
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.id,
|
||||||
lm.host_mac,
|
lm.host_mac,
|
||||||
lm.shop_id,
|
lm.shop_id,
|
||||||
@@ -121,16 +213,15 @@
|
|||||||
gpc.unit,
|
gpc.unit,
|
||||||
gpc.coin,
|
gpc.coin,
|
||||||
gpc.name,
|
gpc.name,
|
||||||
gpc.algorithm,
|
gpc.algorithm
|
||||||
ROW_NUMBER() OVER (
|
|
||||||
PARTITION BY lm.id
|
|
||||||
ORDER BY SUM(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 = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 AND lm.state = 0
|
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
|
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
|
) 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
|
||||||
@@ -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>
|
||||||
|
|
||||||
|
|
||||||
@@ -254,30 +429,55 @@
|
|||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
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
|
SELECT
|
||||||
sub.id,
|
sub.id,
|
||||||
sub.shop_id AS shopId,
|
sub.shop_id ,
|
||||||
sub.type,
|
sub.type,
|
||||||
sub.`user`,
|
sub.`user`,
|
||||||
sub.miner,
|
sub.miner,
|
||||||
sub.state,
|
sub.state,
|
||||||
sub.sale_state AS saleState,
|
sub.sale_state ,
|
||||||
sub.max_lease_days AS maxLeaseDays,
|
sub.max_lease_days ,
|
||||||
sub.del,
|
sub.del,
|
||||||
sub.power_dissipation AS powerDissipation,
|
sub.power_dissipation ,
|
||||||
sub.hashrate AS power,
|
sub.hashrate ,
|
||||||
sub.unit,
|
sub.unit,
|
||||||
sub.coin,
|
sub.coin,
|
||||||
sub.month_income AS monthIncome,
|
sub.month_income,
|
||||||
sub.NAME,
|
sub.NAME,
|
||||||
sub.online_status AS onlineStatus,
|
sub.online_status ,
|
||||||
sub.can_sale_numbers as canSaleNumbers,
|
sub.can_sale_numbers ,
|
||||||
sub.algorithm,
|
sub.algorithm,
|
||||||
ci.id AS cartInfoId,
|
ci.id AS cartInfoId,
|
||||||
ci.numbers,
|
ci.numbers,
|
||||||
ci.lease_time AS leaseTime,
|
ci.lease_time AS lease_time
|
||||||
ROW_NUMBER() OVER ( PARTITION BY sub.id ORDER BY sub.month_income DESC ) AS rn
|
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@@ -297,7 +497,7 @@
|
|||||||
gpc.month_income AS month_income,
|
gpc.month_income AS month_income,
|
||||||
gpc.unit,
|
gpc.unit,
|
||||||
gpc.coin,
|
gpc.coin,
|
||||||
gpc.NAME,
|
gpc.name,
|
||||||
gpc.algorithm
|
gpc.algorithm
|
||||||
FROM
|
FROM
|
||||||
lease_machine lm
|
lease_machine lm
|
||||||
@@ -305,7 +505,7 @@
|
|||||||
GROUP BY
|
GROUP BY
|
||||||
lm.id,
|
lm.id,
|
||||||
gpc.coin,
|
gpc.coin,
|
||||||
gpc.`algorithm`
|
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
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -101,12 +101,18 @@
|
|||||||
t.datetime AS recordTime,
|
t.datetime AS recordTime,
|
||||||
t.hashrate AS power,
|
t.hashrate AS power,
|
||||||
t.miner
|
t.miner
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
sub.datetime,
|
||||||
|
sub.hashrate,
|
||||||
|
sub.miner,
|
||||||
|
@rn := IF(@prev_miner = sub.miner, @rn + 1, 1) AS rn,
|
||||||
|
@prev_miner := sub.miner
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
datetime,
|
datetime,
|
||||||
hashrate,
|
hashrate,
|
||||||
miner,
|
miner
|
||||||
ROW_NUMBER() OVER(PARTITION BY miner ORDER BY datetime DESC) as rn
|
|
||||||
FROM `${pool}`
|
FROM `${pool}`
|
||||||
WHERE wallet = #{wallet}
|
WHERE wallet = #{wallet}
|
||||||
AND coin = #{coin}
|
AND coin = #{coin}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user