租赁系统
This commit is contained in:
78
src/main/resources/mapper/lease/LeaseMachineConfigMapper.xml
Normal file
78
src/main/resources/mapper/lease/LeaseMachineConfigMapper.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?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">
|
||||
<mapper namespace="com.m2pool.lease.mapper.LeaseMachineConfigMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.m2pool.lease.entity.LeaseMachineConfig">
|
||||
<id column="id" property="id" />
|
||||
<result column="machine_id" property="machineId" />
|
||||
<result column="brand" property="brand" />
|
||||
<result column="name" property="name" />
|
||||
<result column="status" property="status" />
|
||||
<result column="coin" property="coin" />
|
||||
<result column="hashrate" property="hashrate" />
|
||||
<result column="algorithm" property="algorithm" />
|
||||
<result column="icon" property="icon" />
|
||||
<result column="unit" property="unit" />
|
||||
<result column="month_income" property="monthIncome" />
|
||||
<result column="power_dissipation" property="powerDissipation" />
|
||||
<result column="del" property="del" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, machine_id, brand, name, status, coin, hashrate, algorithm, icon, unit, month_income, power_dissipation, del
|
||||
</sql>
|
||||
<select id="getConfigList" resultType="com.m2pool.lease.dto.v2.MiningConfigSelectDto">
|
||||
SELECT
|
||||
DISTINCT
|
||||
lpc.id as poolId,
|
||||
lpc.`name` as poolName,
|
||||
lpc.wallet_mining as walletMining,
|
||||
lpcc.coin,
|
||||
lpcc.algorithm,
|
||||
lpcc.id as coinConfigId,
|
||||
lpcc.mining_tcp_gpu_url as miningTcpGpuUrl,
|
||||
lpcc.model_name as modelName,
|
||||
lpcc.model_fee as modelFee
|
||||
FROM
|
||||
lease_pool_coin_config lpcc
|
||||
JOIN
|
||||
lease_pool_config lpc
|
||||
ON lpcc.pool_config_id = lpc.id
|
||||
WHERE
|
||||
lpcc.status = 1 AND lpc.status = 1 AND lpcc.coin = #{coin} AND lpcc.algorithm = #{algorithm}
|
||||
|
||||
</select>
|
||||
<select id="getMachineSupportCoinAndAlgorithm" resultType="com.m2pool.lease.dto.v2.CoinAndAlgorithmDto">
|
||||
SELECT
|
||||
lpc.coin,
|
||||
lpc.algorithm,
|
||||
GROUP_CONCAT(DISTINCT lmc.machine_id ORDER BY lmc.machine_id SEPARATOR ',') AS machineIds
|
||||
FROM
|
||||
lease_pool_coin_config lpc
|
||||
JOIN
|
||||
lease_machine_config lmc ON lpc.coin = lmc.coin AND lpc.algorithm = lmc.algorithm
|
||||
WHERE
|
||||
lpc.status = 1
|
||||
AND lmc.status = 1
|
||||
AND lmc.del = 0
|
||||
<if test="machineIds != null and machineIds.size() > 0">
|
||||
AND lmc.machine_id IN
|
||||
<foreach collection="machineIds" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
lpc.coin, lpc.algorithm
|
||||
</select>
|
||||
<select id="getTheoryHashRate" resultType="com.m2pool.lease.dto.v2.MachineHashRateMapDto">
|
||||
SELECT machine_id as machineId,hashrate as hashRate FROM lease_machine_config
|
||||
-- TODO 这里最好加个算法,加算法后一一对应
|
||||
WHERE del = 0 AND (machine_id,coin) IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
(#{item.machineId},#{item.coin})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user