156
m2pool-modules/m2pool-pool/src/main/resources/bootstrap.yml
Normal file
156
m2pool-modules/m2pool-pool/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,156 @@
|
||||
server:
|
||||
port: 9203
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/json
|
||||
|
||||
spring:
|
||||
#邮箱基本配置
|
||||
mail:
|
||||
# 配置在limit_time内,用户可以发送limit次验证码
|
||||
limit: 2 这个是我额外的配置,结合邮箱服务用的
|
||||
limitTime: 10 这个是我额外的配置
|
||||
#配置smtp服务主机地址
|
||||
# sina smtp.sina.cn
|
||||
# aliyun smtp.aliyun.com
|
||||
# 163 smtp.163.com 端口号465或994
|
||||
host: mail.privateemail.com
|
||||
#发送者邮箱
|
||||
username: support@m2pool.cc
|
||||
#配置密码,注意不是真正的密码,而是刚刚申请到的授权码
|
||||
# password:
|
||||
# password: m2pool2024@!
|
||||
# password: axvm-zfgx-cgcg-qhhu
|
||||
password: m2pool2024@!
|
||||
#端口号
|
||||
port: 587
|
||||
#默认的邮件编码为UTF-8
|
||||
default-encoding: UTF-8
|
||||
#其他参数
|
||||
properties:
|
||||
mail:
|
||||
#配置SSL 加密工厂
|
||||
smtp:
|
||||
ssl:
|
||||
#本地测试,先放开ssl
|
||||
enable: false
|
||||
required: false
|
||||
#开启debug模式,这样邮件发送过程的日志会在控制台打印出来,方便排查错误
|
||||
debug: false
|
||||
socketFactory:
|
||||
class: javax.net.ssl.SSLSocketFactory
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: m2pool-pool
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: prod
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址 172.16.2.5
|
||||
server-addr: 127.0.0.1:8808
|
||||
namespace: m2_prod
|
||||
group: m2_prod_group
|
||||
# server-addr: 127.0.0.1:8808
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8808
|
||||
# server-addr: 127.0.0.1:8808
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: m2_prod
|
||||
group: m2_prod_group
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 2MB
|
||||
max-request-size: 8MB
|
||||
|
||||
myenv:
|
||||
domain: https://www.m2pool.com
|
||||
path: /var/www/html/web
|
||||
img: /img
|
||||
filepath: /home/ubuntu/prod
|
||||
|
||||
|
||||
#server:
|
||||
# port: 9503
|
||||
# compression:
|
||||
# enabled: true
|
||||
# mime-types: application/json
|
||||
#
|
||||
#spring:
|
||||
# #邮箱基本配置
|
||||
# mail:
|
||||
# # 配置在limit_time内,用户可以发送limit次验证码
|
||||
# limit: 2 这个是我额外的配置,结合邮箱服务用的
|
||||
# limitTime: 10 这个是我额外的配置
|
||||
# #配置smtp服务主机地址
|
||||
# # sina smtp.sina.cn
|
||||
# # aliyun smtp.aliyun.com
|
||||
# # 163 smtp.163.com 端口号465或994
|
||||
# host: mail.privateemail.com
|
||||
# #发送者邮箱
|
||||
# username: support@m2pool.cc
|
||||
# #配置密码,注意不是真正的密码,而是刚刚申请到的授权码
|
||||
# # password:
|
||||
# # password: m2pool2024@!
|
||||
# # password: axvm-zfgx-cgcg-qhhu
|
||||
# password: m2pool2024@!
|
||||
# #端口号
|
||||
# port: 587
|
||||
# #默认的邮件编码为UTF-8
|
||||
# default-encoding: UTF-8
|
||||
# #其他参数
|
||||
# properties:
|
||||
# mail:
|
||||
# #配置SSL 加密工厂
|
||||
# smtp:
|
||||
# ssl:
|
||||
# #本地测试,先放开ssl
|
||||
# enable: false
|
||||
# required: false
|
||||
# #开启debug模式,这样邮件发送过程的日志会在控制台打印出来,方便排查错误
|
||||
# debug: false
|
||||
# socketFactory:
|
||||
# class: javax.net.ssl.SSLSocketFactory
|
||||
#
|
||||
# application:
|
||||
# # 应用名称
|
||||
# name: m2pool-pool
|
||||
# profiles:
|
||||
# # 环境配置
|
||||
# active: test
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# # 服务注册地址 172.16.2.5
|
||||
# server-addr: 127.0.0.1:8808
|
||||
# namespace: m2_test
|
||||
# group: m2_test_group
|
||||
## server-addr: 127.0.0.1:8808
|
||||
# config:
|
||||
# # 配置中心地址
|
||||
# server-addr: 127.0.0.1:8808
|
||||
## server-addr: 127.0.0.1:8808
|
||||
# # 配置文件格式
|
||||
# file-extension: yml
|
||||
# # 共享配置
|
||||
# shared-configs:
|
||||
# - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# namespace: m2_test
|
||||
# group: m2_test_group
|
||||
# servlet:
|
||||
# multipart:
|
||||
# max-file-size: 2MB
|
||||
# max-request-size: 8MB
|
||||
#
|
||||
#myenv:
|
||||
# domain: https://test.m2pool.com
|
||||
# path: /var/www/html/web_test
|
||||
# img: /img
|
||||
# filepath: /home/ubuntu/web
|
||||
74
m2pool-modules/m2pool-pool/src/main/resources/logback.xml
Normal file
74
m2pool-modules/m2pool-pool/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/m2pool-pool" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.m2pool" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?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.pool.mapper.AccountDistributionMapper">
|
||||
|
||||
<select id="getDistributionByMinerAccount" resultType="com.m2pool.pool.dto.ProfitDto">
|
||||
select
|
||||
id,
|
||||
create_date `date`,
|
||||
amount profit,
|
||||
`state` status
|
||||
from
|
||||
wallet_in
|
||||
where
|
||||
`user`=#{ma} and coin =#{coin}
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getOutcomeListByCoinAndUser" resultType="com.m2pool.pool.dto.OutcomeDto">
|
||||
select
|
||||
`date`,
|
||||
coin,
|
||||
address,
|
||||
amount,
|
||||
tx_id txid
|
||||
from
|
||||
wallet_outv2
|
||||
where
|
||||
coin= #{coin}
|
||||
and `user` = #{ma}
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDayDistributionByMinerAccount" resultType="com.m2pool.pool.dto.ProfitDto">
|
||||
select
|
||||
create_date `date`,
|
||||
amount profit,
|
||||
`state` status
|
||||
from
|
||||
wallet_in
|
||||
where
|
||||
`user`= #{ma}
|
||||
and coin=#{coin}
|
||||
order by create_date desc
|
||||
</select>
|
||||
|
||||
<select id="getDayPendingByMinerAccount" resultType="com.m2pool.pool.dto.ProfitDto">
|
||||
select
|
||||
create_date `date`,
|
||||
amount profit,
|
||||
`state` status
|
||||
from
|
||||
wallet_in
|
||||
where
|
||||
`user`= #{ma}
|
||||
and coin=#{coin}
|
||||
and `state`= 0
|
||||
order by create_date desc
|
||||
</select>
|
||||
|
||||
<select id="getTotalOutByCoinAndUser" resultType="java.math.BigDecimal">
|
||||
select sum(amount) from wallet_outv2 where coin=#{coin} and `user`=#{ma} group by coin,`user`
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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.pool.mapper.GoogleAuthMapper">
|
||||
<update id="bingGoogleAuthenticator">
|
||||
update sys_user
|
||||
set
|
||||
google_auth = #{info.secret},
|
||||
google_status = #{info.status},
|
||||
update_time = sysdate()
|
||||
where user_name = #{info.email}
|
||||
</update>
|
||||
|
||||
<select id="checkIfBindByEmail" resultType="java.lang.Boolean">
|
||||
select COUNT(google_auth) from sys_user where email = #{email} and google_status=1
|
||||
</select>
|
||||
|
||||
<select id="getGoogleInfoByEmail" resultType="com.m2pool.pool.entity.GoogleInfo">
|
||||
select
|
||||
email,
|
||||
google_auth secret,
|
||||
google_status status
|
||||
from
|
||||
sys_user
|
||||
where
|
||||
email = #{email}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkSecretIfExist" resultType="java.lang.Boolean">
|
||||
select COUNT(1) from sys_user where google_auth = #{secret}
|
||||
</select>
|
||||
|
||||
<select id="getUserInfoByEmail" resultType="com.m2pool.pool.entity.UserGoogleAuthInfo">
|
||||
select
|
||||
email,
|
||||
password pwd,
|
||||
google_auth secret,
|
||||
google_status status
|
||||
from
|
||||
sys_user
|
||||
where
|
||||
email = #{email}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="closeGoogleAuthenticator">
|
||||
update sys_user
|
||||
set
|
||||
google_auth = '',
|
||||
google_status = 0,
|
||||
update_time = sysdate()
|
||||
where user_name = #{info.email}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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.pool.mapper.NoticeMapper">
|
||||
<insert id="addNoticeEmail">
|
||||
insert into notice_info(
|
||||
ma_id,
|
||||
email,
|
||||
<if test="vo.remark != null and vo.remark != ''">remark,</if>
|
||||
create_time
|
||||
) values(
|
||||
#{vo.maId},
|
||||
#{vo.email},
|
||||
<if test="vo.remark != null and vo.remark != ''">#{vo.remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateInfo">
|
||||
update notice_info
|
||||
set
|
||||
remark = #{vo.remark}
|
||||
where id = #{vo.id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNoticeInfoById">
|
||||
delete from notice_info where id=#{vo.id} and ma_id=#{maId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getNoticeEmailListByMaId" resultType="com.m2pool.pool.dto.NoticeListDto">
|
||||
select
|
||||
n.id,
|
||||
n.email,
|
||||
n.remark
|
||||
from
|
||||
notice_info n
|
||||
left join user_miner_account u on n.ma_id = u.id
|
||||
where
|
||||
u.user=#{user}
|
||||
and n.ma_id=#{vo.maId}
|
||||
</select>
|
||||
|
||||
<select id="checkIdAndMa" resultType="java.lang.Boolean">
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
notice_info n
|
||||
left join user_miner_account u on n.ma_id = u.id
|
||||
where
|
||||
u.user=#{user}
|
||||
and n.id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getMaIdByIdAndUser" resultType="java.lang.Long">
|
||||
select
|
||||
n.ma_id
|
||||
from
|
||||
notice_info n
|
||||
left join user_miner_account u on n.ma_id = u.id
|
||||
where
|
||||
u.user=#{user}
|
||||
and n.id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getNoticeEmailCountByMaId" resultType="java.lang.Integer">
|
||||
select count(*) from notice_info where ma_id=#{maId}
|
||||
</select>
|
||||
|
||||
<select id="checkEmailIfExist" resultType="java.lang.Boolean">
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
notice_info
|
||||
where
|
||||
ma_id=#{maId}
|
||||
and email=#{email}
|
||||
</select>
|
||||
<select id="getNoticeEmailListByMinerAndCoin" resultType="com.m2pool.pool.dto.NoticeMinerCoinListDto">
|
||||
select
|
||||
n.email email,
|
||||
u.miner_user miner
|
||||
from
|
||||
notice_info n
|
||||
left join user_miner_account u on n.ma_id=u.id
|
||||
where
|
||||
u.miner_user in
|
||||
<foreach collection="list" index="index" open="(" separator="," close=")" item="miner">
|
||||
#{miner.user}
|
||||
</foreach>
|
||||
and coin=#{coin}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,886 @@
|
||||
<?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.pool.mapper.PoolMapper">
|
||||
|
||||
<select id="getPoolInfoByCoin" resultType="com.m2pool.pool.dto.PoolInfoDto">
|
||||
select
|
||||
count(*) poolMc
|
||||
from
|
||||
${table}
|
||||
where
|
||||
`state` ='online'
|
||||
group by `date`,`state`
|
||||
order by `date` desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="get30mPoolPowerList" resultType="com.m2pool.pool.dto.PowerLineDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
mhs pv
|
||||
from
|
||||
${table}
|
||||
order by `date` desc limit 48
|
||||
</select>
|
||||
|
||||
<select id="getDailyPoolPowerList" resultType="com.m2pool.pool.dto.PowerLineDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
mhs pv
|
||||
from
|
||||
${table}
|
||||
order by `date` desc limit 30
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getGRSBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
grs_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getMonaBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
mona_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDgbQubitBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbq_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDgbSkeinBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbs_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDGBODOBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbo_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDgbQubitA10BlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgb_qubit_a10_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDgbSkeinA10BlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgb_skein_a10_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDGBODOB20BlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgb_odo_b20_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getNEXABlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
nexa_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="get30mAccountPowerListByAccount" resultType="com.m2pool.pool.dto.PowerLineDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
mhs pv
|
||||
from
|
||||
${table}
|
||||
where
|
||||
`user` = "${user}"
|
||||
order by date desc limit 48
|
||||
</select>
|
||||
|
||||
<select id="getDailyAccountPowerListByAccount" resultType="com.m2pool.pool.dto.PowerLineDto" statementType="STATEMENT">
|
||||
select
|
||||
t.date `date`,
|
||||
p.user,
|
||||
t.mhs pv
|
||||
from
|
||||
${table} p
|
||||
join (
|
||||
SELECT
|
||||
`date`,
|
||||
`user`,
|
||||
sum(mhs) mhs
|
||||
FROM
|
||||
${table}
|
||||
where
|
||||
`user` = "${user}" GROUP BY `date`,`user`) t
|
||||
on p.date =t.date
|
||||
where
|
||||
p.`user` = "${user}"
|
||||
group by t.date,p.user
|
||||
order by t.date desc limit 30
|
||||
</select>
|
||||
|
||||
<select id="getDailyAccountPowerDistributionList" resultType="com.m2pool.pool.dto.MinerDataDto" statementType="STATEMENT">
|
||||
select
|
||||
m.date,
|
||||
m.user `user`,
|
||||
m.miner miner,
|
||||
m.mhs mhs
|
||||
from
|
||||
${table} m
|
||||
join(
|
||||
SELECT
|
||||
MAX(`date`) AS last_time,
|
||||
user
|
||||
FROM
|
||||
${table}
|
||||
where
|
||||
`user` = "${user}"
|
||||
GROUP BY `date` ,`user`
|
||||
order by `date` desc limit 1
|
||||
) t
|
||||
on m.date = t.last_time
|
||||
where m.date = t.last_time and m.`user` = "${user}"
|
||||
</select>
|
||||
|
||||
<select id="getMinerPowerList" resultType="com.m2pool.pool.dto.PowerLineDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
mhs pv
|
||||
from
|
||||
${table} p
|
||||
where
|
||||
`user` = '${user}'
|
||||
and miner = '${miner}'
|
||||
order by `date` desc limit 48
|
||||
</select>
|
||||
|
||||
<select id="getDailyMinerPowerDistributionList" resultType="com.m2pool.pool.dto.MinerDataDto" statementType="STATEMENT">
|
||||
select
|
||||
m.date,
|
||||
m.user `user`,
|
||||
m.miner miner,
|
||||
m.mhs24h mhs
|
||||
from
|
||||
${table} m
|
||||
join(
|
||||
SELECT
|
||||
MAX(`date`) AS last_time,
|
||||
user
|
||||
FROM
|
||||
${table}
|
||||
where
|
||||
`user` = "${user}"
|
||||
and miner = "${miner}"
|
||||
GROUP BY `date` ,`user`
|
||||
order by `date` desc limit 1
|
||||
) t
|
||||
on m.date = t.last_time
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getHourMinerDataList" resultType="com.m2pool.pool.dto.MinerDataDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
miner miner,
|
||||
mhs30m mhs,
|
||||
`state`,
|
||||
last_submit lastSubmit
|
||||
from
|
||||
${table}
|
||||
where
|
||||
`date` = '${now}'
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getDailyMinerDataList" resultType="com.m2pool.pool.dto.MinerDataDto" statementType="STATEMENT">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
miner,
|
||||
mhs24h mhs,
|
||||
`state`,
|
||||
last_submit lastSubmit
|
||||
from
|
||||
${table}
|
||||
where
|
||||
`date` = '${now}'
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getLastDataTime" resultType="java.lang.Integer">
|
||||
select count(`date`) from ${table} where `date` >= '${date}' order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getDailyPoolPowerDistributionList" resultType="com.m2pool.pool.dto.MinerDataDto">
|
||||
select
|
||||
m.date,
|
||||
m.user `user`,
|
||||
m.miner miner,
|
||||
m.mhs24h mhs
|
||||
from
|
||||
${table} m
|
||||
join(
|
||||
SELECT
|
||||
DATE_FORMAT(`date`, '%Y-%m-%d 00:00:00') AS dfdate,
|
||||
MAX(`date`) AS last_time
|
||||
FROM
|
||||
${table}
|
||||
GROUP BY `date`
|
||||
order by `date` desc limit 1
|
||||
) t
|
||||
on m.date = t.last_time
|
||||
</select>
|
||||
|
||||
<select id="getNowPoolPower" resultType="java.lang.Double">
|
||||
select sum(mhs30m) from ${table} group by `date` order by `date` desc limit 1;
|
||||
</select>
|
||||
|
||||
<select id="getMinerInfoList" resultType="com.m2pool.pool.dto.MinerDataDto">
|
||||
select
|
||||
m.`date`,
|
||||
m.`user`,
|
||||
m.miner,
|
||||
m.last_submit lastSubmit,
|
||||
m.`state` online,
|
||||
m.mhs30m mhs,
|
||||
m.mhs24h mhs24h
|
||||
from
|
||||
${table}_realv2 m
|
||||
left join(
|
||||
SELECT
|
||||
MAX(`date`) AS last_time
|
||||
FROM
|
||||
${table}_realv2
|
||||
order by `date` desc limit 1
|
||||
) t
|
||||
on m.date = t.last_time
|
||||
where
|
||||
m.date = t.last_time
|
||||
</select>
|
||||
|
||||
<select id="get24hMinerInfoList" resultType="com.m2pool.pool.dto.MinerDataDto">
|
||||
select
|
||||
m.`date`,
|
||||
m.`user`,
|
||||
m.miner,
|
||||
m.last_submit lastSubmit,
|
||||
m.`state` online,
|
||||
m.mhs mhs
|
||||
from
|
||||
${table} m
|
||||
left join(
|
||||
SELECT
|
||||
MAX(`date`) AS last_time
|
||||
FROM
|
||||
${table}
|
||||
order by `date` desc limit 1
|
||||
) t
|
||||
on m.date = t.last_time
|
||||
where
|
||||
m.date = t.last_time
|
||||
</select>
|
||||
|
||||
<select id="getUserHourMinerDataList" resultType="com.m2pool.pool.dto.MinerDataDto">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
shares1h accepts,
|
||||
rejects1h rejects,
|
||||
mhs1h mhs,
|
||||
mhs24h mhs24h,
|
||||
ratio1h rejectsRatio
|
||||
from
|
||||
${table} p
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getUserDailyMinerDataList" resultType="com.m2pool.pool.dto.MinerDataDto">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
shares24h accepts,
|
||||
rejects24h rejects,
|
||||
mhs1h mhs,
|
||||
mhs24h mhs24h,
|
||||
ratio24h rejectsRatio
|
||||
from
|
||||
${table}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getHourNetPowerList" resultType="com.m2pool.pool.dto.PowerLineDto">
|
||||
select
|
||||
p.date `date`,
|
||||
p.value price,
|
||||
np.value pv
|
||||
from
|
||||
${table}_price p
|
||||
left join ${table}_net_power np on p.date = np.date
|
||||
</select>
|
||||
|
||||
<select id="getNewNEXABlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
nexa_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNowPoolDailyPower" resultType="java.lang.Double">
|
||||
select sum(mhs30m) from ${table} group by `date` order by `date` desc limit 1;
|
||||
</select>
|
||||
|
||||
<select id="get24hAccountPowerListByAccount" resultType="com.m2pool.pool.dto.PowerLineDto">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
mhs pv
|
||||
from
|
||||
${table}
|
||||
where
|
||||
`user` = "${user}"
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getPoolTodayTotalPower" resultType="java.math.BigDecimal">
|
||||
select sum(mhs) from ${coin}_pool_30m where `date` > '${date}';
|
||||
</select>
|
||||
|
||||
<select id="getUserTodayTotalPower" resultType="com.m2pool.pool.dto.UserPowerDto">
|
||||
select user,sum(mhs) mhs from ${coin}_users_30m where date > '${date}' group by `user`
|
||||
</select>
|
||||
|
||||
<select id="getDailyPoolPower" resultType="com.m2pool.pool.dto.DateBigDecimalDto">
|
||||
select DATE(`date`) as pDate,avg(mhs) `value` from ${coin}_pool_30m group by pDate order by pDate
|
||||
</select>
|
||||
|
||||
<select id="getDailyNetPower" resultType="com.m2pool.pool.dto.DateBigDecimalDto">
|
||||
select DATE(`date`) as pDate,avg(`value`) `value` from ${coin}_net_power group by pDate order by pDate
|
||||
</select>
|
||||
|
||||
<select id="getNewGRSBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
grs_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNewMONABlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
mona_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNewDGBQBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbq_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNewDGBSBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbs_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNewDGBOBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
dgbo_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
<select id="getAvgNetPower" resultType="java.math.BigDecimal">
|
||||
select avg(`value`) from ${coin}_net_power where date > '${date}'
|
||||
</select>
|
||||
|
||||
<select id="getNewRXDBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
rxd_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getRXDBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
rxd_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
<select id="getOfflineList" resultType="com.m2pool.pool.dto.OfflineUserMinerDto">
|
||||
select
|
||||
`date`,
|
||||
`user`,
|
||||
GROUP_CONCAT(miner SEPARATOR ' | ') miners,
|
||||
count(*) offline
|
||||
from
|
||||
${table}
|
||||
where
|
||||
state='offline' and date >= '${date}' group by date,user;
|
||||
</select>
|
||||
|
||||
<select id="getALPHBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
alph_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getENXBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
enx_pool_blkstats
|
||||
order by `date` desc
|
||||
</select>
|
||||
|
||||
<select id="getNewALPHBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
alph_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<select id="getNewENXBlockInfoList" resultType="com.m2pool.pool.dto.BlockInfoDto">
|
||||
select
|
||||
height,
|
||||
`date`,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
from
|
||||
enx_blkreportprofitv2
|
||||
where
|
||||
`date` > #{date}
|
||||
order by `date`
|
||||
</select>
|
||||
|
||||
<insert id="batchInsertMhsDataToDB" statementType="STATEMENT">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`user`,
|
||||
miner,
|
||||
mhs,
|
||||
`state`,
|
||||
last_submit
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
'${i.date}',
|
||||
'${i.user}',
|
||||
'${i.miner}',
|
||||
${i.mhs},
|
||||
'${i.state}',
|
||||
'${i.lastSubmit}'
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertUserMhsDataToDB">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`user`,
|
||||
mhs,
|
||||
mhs24h,
|
||||
accepts,
|
||||
rejects,
|
||||
rejects_ratio
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
'${i.date}',
|
||||
'${i.user}',
|
||||
${i.mhs},
|
||||
${i.mhs24h},
|
||||
${i.accepts},
|
||||
${i.rejects},
|
||||
${i.rejectsRatio}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="insertNetPower">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`value`
|
||||
) values(
|
||||
'${date}',
|
||||
${vo.value}
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrice">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`value`
|
||||
) values(
|
||||
'${date}',
|
||||
${vo.value}
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertNexaPoolBlkToDB">
|
||||
insert into nexa_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPoolPower">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`mhs`,
|
||||
`miners`,
|
||||
`online`,
|
||||
`offline`
|
||||
) values(
|
||||
'${vo.dateStr}',
|
||||
${vo.mhs},
|
||||
${vo.miners},
|
||||
${vo.online},
|
||||
${vo.offline}
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertUserMhsDateToDB">
|
||||
insert into ${table}(
|
||||
`date`,
|
||||
`user`,
|
||||
`mhs`
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
'${i.date}',
|
||||
'${i.user}',
|
||||
${i.mhs}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertGRSPoolBlkToDB">
|
||||
insert into grs_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertMONAPoolBlkToDB">
|
||||
insert into mona_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertDGBOPoolBlkToDB">
|
||||
insert into dgbo_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertDGBQPoolBlkToDB">
|
||||
insert into dgbq_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertDGBSPoolBlkToDB">
|
||||
insert into dgbs_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertRXDPoolBlkToDB">
|
||||
insert into rxd_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertALPHPoolBlkToDB">
|
||||
insert into alph_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
<insert id="batchInsertENXPoolBlkToDB">
|
||||
insert into enx_pool_blkstats (
|
||||
`date`,
|
||||
height,
|
||||
hash,
|
||||
reward,
|
||||
fees
|
||||
) values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.date},
|
||||
#{i.height},
|
||||
#{i.hash},
|
||||
#{i.reward},
|
||||
#{i.fees}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`date` = VALUES(`date`)
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
<?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.pool.mapper.TicketMapper">
|
||||
|
||||
<select id="getPrivateTicketList" resultType="com.m2pool.pool.dto.PrivateTicketListDto">
|
||||
select
|
||||
id,create_time `date`,email,status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
email = #{email}
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
and id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.start != null and vo.start != ''">
|
||||
and create_time >= #{vo.start}
|
||||
</if>
|
||||
<if test="vo.end != null and vo.end != ''">
|
||||
and create_time <= #{vo.end}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getPrivateProcessingTicketList" resultType="com.m2pool.pool.dto.PrivateTicketListDto">
|
||||
select
|
||||
id,
|
||||
create_time `date`,
|
||||
email,
|
||||
status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
status != 10 and email = #{email}
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
and id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.start != null and vo.start != ''">
|
||||
and create_time >= #{vo.start}
|
||||
</if>
|
||||
<if test="vo.end != null and vo.end != ''">
|
||||
and create_time <= #{vo.end}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getPrivateEndTicketList" resultType="com.m2pool.pool.dto.PrivateTicketListDto">
|
||||
select
|
||||
id,
|
||||
create_time `date`,
|
||||
email,
|
||||
status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
status = 10 and email = #{email}
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
and id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.start != null and vo.start != ''">
|
||||
and create_time >= #{vo.start}
|
||||
</if>
|
||||
<if test="vo.end != null and vo.end != ''">
|
||||
and create_time <= #{vo.end}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getTicketById" resultType="com.m2pool.pool.dto.TicketDto">
|
||||
select
|
||||
id,
|
||||
email,
|
||||
`desc`,
|
||||
create_time createTime,
|
||||
status
|
||||
from
|
||||
ticket
|
||||
where
|
||||
id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getTicketResponListByTicketId" resultType="com.m2pool.pool.dto.TicketContentDto">
|
||||
select
|
||||
create_time `time`,
|
||||
respon content,
|
||||
responer name,
|
||||
files,
|
||||
video_file videoPath,
|
||||
image_file imagePath,
|
||||
audio_file audioPath
|
||||
from
|
||||
respon
|
||||
<where>
|
||||
<if test="id != null and id != 0">
|
||||
ticket_id = #{id}
|
||||
</if>
|
||||
</where>
|
||||
order BY create_time
|
||||
</select>
|
||||
|
||||
<select id="getTicketSupplementCountByTicketId" resultType="java.lang.Integer">
|
||||
select count(*) from ticket_supplement where ticket_id = #{id};
|
||||
</select>
|
||||
|
||||
<select id="getTicketSupplementListByTicketId" resultType="com.m2pool.pool.dto.TicketContentDto">
|
||||
select
|
||||
s.create_time `time`,
|
||||
s.content content,
|
||||
s.files files,
|
||||
s.video_file videoPath,
|
||||
s.image_file imagePath,
|
||||
s.audio_file audioPath,
|
||||
t.email name
|
||||
from
|
||||
ticket_supplement s left join ticket t on s.ticket_id = t.id
|
||||
<where>
|
||||
<if test="id != null and id != 0">
|
||||
s.ticket_id = #{id}
|
||||
</if>
|
||||
</where>
|
||||
order by s.create_time,s.id
|
||||
</select>
|
||||
|
||||
<select id="checkTicketExist" resultType="java.lang.Integer">
|
||||
select count(1) from ticket where id = #{id} limit 1
|
||||
</select>
|
||||
|
||||
<update id="changeTicketUpdateTime">
|
||||
UPDATE ticket SET update_time=sysdate() WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getTicketListByCond" resultType="com.m2pool.pool.dto.AllTicketListDto">
|
||||
select
|
||||
id,
|
||||
create_time `date`,
|
||||
email email,
|
||||
`desc`,
|
||||
status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
AND id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.email != null and vo.email != ''">
|
||||
AND email = #{vo.email}
|
||||
</if>
|
||||
<if test="vo.start != null and vo.start != ''"><!-- 开始时间检索 -->
|
||||
and create_time > #{vo.start}
|
||||
</if>
|
||||
<if test="vo.end != null and vo.end != ''"><!-- 结束时间检索 -->
|
||||
and create_time < #{vo.end}
|
||||
</if>
|
||||
<if test="vo.status != null and vo.status != 0">
|
||||
AND status = #{vo.status}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getPrivateTicketById" resultType="com.m2pool.pool.dto.TicketPrivateDto">
|
||||
select
|
||||
id,
|
||||
email,
|
||||
`desc`,
|
||||
create_time createTime,
|
||||
status
|
||||
from
|
||||
ticket t
|
||||
where
|
||||
t.id = #{id}
|
||||
and t.email = #{email}
|
||||
</select>
|
||||
|
||||
<select id="getTicketListByStatusAndType" resultType="com.m2pool.pool.dto.TicketListDto">
|
||||
select
|
||||
id,create_time `date`,email,status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
status = #{vo.status}
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
AND id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.email != null and vo.email != ''">
|
||||
AND email = #{vo.email}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getBackendTicketById" resultType="com.m2pool.pool.dto.TicketPrivateDto">
|
||||
select
|
||||
id,
|
||||
email,
|
||||
`desc`,
|
||||
create_time createTime,
|
||||
status
|
||||
from
|
||||
ticket
|
||||
where
|
||||
id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getTicketStatusById" resultType="java.lang.Integer">
|
||||
select status from ticket where id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getFileInfoById" resultType="com.m2pool.pool.entity.M2File">
|
||||
select id,file_name fileName,url,user_name userName,create_time createTime from file where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getAllTicketList" resultType="com.m2pool.pool.dto.TicketListDto">
|
||||
select
|
||||
id,create_time `date`,email,status
|
||||
from
|
||||
ticket
|
||||
<where>
|
||||
<if test="vo.id != null and vo.id != 0">
|
||||
AND id = #{vo.id}
|
||||
</if>
|
||||
<if test="vo.email != null and vo.email != ''">
|
||||
AND email = #{vo.email}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<update id="changeTicketStatus">
|
||||
UPDATE ticket SET status=#{status},update_time =sysdate() WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertTicket" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ticket(
|
||||
<if test="data.email != null and data.email !=''">email,</if>
|
||||
<if test="data.desc != null and data.desc != ''">`desc`,</if>
|
||||
<if test="data.status != null and data.status != 0">status,</if>
|
||||
create_time,update_time
|
||||
)values(
|
||||
<if test="data.email != null and data.email != ''">#{data.email},</if>
|
||||
<if test="data.desc != null and data.desc != ''">#{data.desc},</if>
|
||||
<if test="data.status != null and data.status != 0">1,</if>
|
||||
sysdate(),sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertTicketSupplement">
|
||||
insert into ticket_supplement(
|
||||
ticket_id,
|
||||
content,
|
||||
<if test="vo.files != null and vo.files != ''">files,</if>
|
||||
<if test="vo.videoFiles != null and vo.videoFiles != ''">video_file,</if>
|
||||
<if test="vo.imageFiles != null and vo.imageFiles != ''">image_file,</if>
|
||||
<if test="vo.audioFiles != null and vo.audioFiles != ''">audio_file,</if>
|
||||
create_time
|
||||
) values (
|
||||
#{vo.id},
|
||||
#{vo.desc},
|
||||
<if test="vo.files != null and vo.files != ''">#{vo.files},</if>
|
||||
<if test="vo.videoFiles != null and vo.videoFiles != ''">#{vo.videoFiles},</if>
|
||||
<if test="vo.imageFiles != null and vo.imageFiles != ''">#{vo.imageFiles},</if>
|
||||
<if test="vo.audioFiles != null and vo.audioFiles != ''">#{vo.audioFiles},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertRespon">
|
||||
insert into respon(
|
||||
ticket_id,
|
||||
respon,
|
||||
responer,
|
||||
create_time
|
||||
) values(
|
||||
#{vo.id},
|
||||
#{vo.respon},
|
||||
#{name},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertFileInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into `file`(url,file_name,user_name,`type`,create_time) values(
|
||||
#{vo.url},#{vo.fileName},#{vo.userName},#{vo.fileType},sysdate()
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,315 @@
|
||||
<?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.pool.mapper.UserAccountMapper">
|
||||
|
||||
<insert id="userAddMinerAccount" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_miner_account(
|
||||
`user`,
|
||||
miner_user,
|
||||
coin,
|
||||
<if test="vo.remark != null and vo.remark != ''">remark,</if>
|
||||
create_date) values(
|
||||
#{vo.user},
|
||||
#{vo.ma},
|
||||
#{vo.coin},
|
||||
<if test="vo.remark != null and vo.remark != ''">#{vo.remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="accountAddBalance">
|
||||
insert into user_account_balance(
|
||||
`ma_id`,
|
||||
balance,
|
||||
amount
|
||||
<if test="vo.active != null and vo.active != 0">,#{vo.active}</if>
|
||||
) values (
|
||||
#{accountId},
|
||||
#{vo.balance},
|
||||
#{vo.amount}
|
||||
<if test="vo.active != null and vo.active != 0">,#{vo.active}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="createReadOnlyPage">
|
||||
insert into user_page_info(
|
||||
`user`,
|
||||
account,
|
||||
coin,
|
||||
config,
|
||||
url_key,
|
||||
lang
|
||||
<if test="vo.remark != null and vo.remark != ''">,remark</if>
|
||||
,create_time
|
||||
) values (
|
||||
#{vo.email},
|
||||
#{vo.account},
|
||||
#{vo.coin},
|
||||
#{vo.config},
|
||||
#{vo.key},
|
||||
#{vo.lang}
|
||||
<if test="vo.remark != null and vo.remark != ''">,#{vo.remark}</if>
|
||||
,sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="userCreateApiKey">
|
||||
insert into user_api(
|
||||
`user`,
|
||||
api_key,
|
||||
api_ip,
|
||||
perms
|
||||
) value (
|
||||
#{vo.user},
|
||||
#{vo.key},
|
||||
#{vo.apiIp},
|
||||
#{vo.permissions}
|
||||
)
|
||||
|
||||
</insert>
|
||||
|
||||
<update id="batchDelAccount">
|
||||
update user_miner_account set status = 11 where id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">#{id}</foreach>;
|
||||
</update>
|
||||
|
||||
<update id="accountStopBalance">
|
||||
update user_account_balance set status = 99 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBalance">
|
||||
update
|
||||
user_account_balance
|
||||
set
|
||||
amount = #{vo.amount}
|
||||
,active = #{vo.active}
|
||||
where id = #{id} and status = 0
|
||||
</update>
|
||||
|
||||
<update id="updateMinerAccountRemark">
|
||||
update
|
||||
user_miner_account
|
||||
set
|
||||
remark = #{vo.remarks}
|
||||
where id = #{accountId} and status = 0
|
||||
</update>
|
||||
|
||||
<update id="changeReadOnlyPage">
|
||||
update
|
||||
user_page_info
|
||||
set
|
||||
config = #{vo.config}
|
||||
<if test="vo.remark != null and vo.remark != ''">, remark = #{vo.remark}</if>
|
||||
where url_key =#{vo.key}
|
||||
</update>
|
||||
|
||||
<update id="updateApiKey" useGeneratedKeys="true">
|
||||
update
|
||||
user_api
|
||||
set
|
||||
api_ip = #{vo.ip}
|
||||
<if test="vo.perms != null and vo.perms != ''">, perms = #{vo.perms}</if>
|
||||
where id =#{vo.id} and `user` =#{user}
|
||||
</update>
|
||||
|
||||
<delete id="batchDeletePageByKeyAndUser">
|
||||
delete from user_page_info
|
||||
where url_key in
|
||||
<foreach item="key" collection="keys" open="(" separator="," close=")">
|
||||
#{key}
|
||||
</foreach>
|
||||
and `user` = #{user}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDeleteAPIByIdsAndUser">
|
||||
delete from user_api
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and `user` = #{user}
|
||||
</delete>
|
||||
|
||||
<select id="getAccountByUserAndMinerAccount" resultType="com.m2pool.pool.dto.UserAccountDto">
|
||||
select
|
||||
`user`,
|
||||
miner_user account,
|
||||
coin
|
||||
from
|
||||
user_miner_account
|
||||
where
|
||||
`user` = #{user}
|
||||
and miner_user = #{ma}
|
||||
and status = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getAccountByUserAndCoin" resultType="com.m2pool.pool.dto.UserAccountListDto">
|
||||
select
|
||||
a.id id,
|
||||
a.miner_user ma,
|
||||
a.coin,
|
||||
a.remark,
|
||||
b.balance addr
|
||||
from
|
||||
user_miner_account a
|
||||
left join user_account_balance b on a.id = b.ma_id
|
||||
where
|
||||
`user` = #{user}
|
||||
and a.status = 0
|
||||
and b.status = 0
|
||||
</select>
|
||||
|
||||
<select id="getBalanceByMinerAccount" resultType="com.m2pool.pool.dto.MinerAccountBalanceDto">
|
||||
select
|
||||
b.id,
|
||||
b.balance,
|
||||
b.active,
|
||||
b.amount,
|
||||
a.remark remark
|
||||
from
|
||||
user_account_balance b
|
||||
left join user_miner_account a on a.id = b.ma_id
|
||||
where
|
||||
`ma_id` = #{maId}
|
||||
and a.status = 0
|
||||
and b.status = 0
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getAccountByUserAccountAndCoin" resultType="com.m2pool.pool.dto.UserAccountDto">
|
||||
select
|
||||
id,
|
||||
`user`,
|
||||
miner_user account,
|
||||
coin
|
||||
from
|
||||
user_miner_account
|
||||
where
|
||||
`user` = #{user}
|
||||
and miner_user = #{account}
|
||||
and coin = #{coin}
|
||||
and status = 0
|
||||
</select>
|
||||
|
||||
<select id="getAccountNumberByUserAccountAndCoin" resultType="java.lang.Integer">
|
||||
select
|
||||
count(miner_user)
|
||||
from
|
||||
user_miner_account
|
||||
where
|
||||
`user` = #{user}
|
||||
and coin = #{coin}
|
||||
and status = 0
|
||||
</select>
|
||||
|
||||
<select id="getAccountByUserAccountId" resultType="com.m2pool.pool.dto.UserAccountDto">
|
||||
select
|
||||
id,
|
||||
`user`,
|
||||
miner_user account,
|
||||
coin
|
||||
from
|
||||
user_miner_account
|
||||
where
|
||||
`user` = #{user}
|
||||
and `id` = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkAccountIfExist" resultType="java.lang.Boolean">
|
||||
select count(1) from user_miner_account where miner_user=#{account} and coin=#{coin}
|
||||
</select>
|
||||
|
||||
<select id="getBalanceByCoin" resultType="com.m2pool.pool.dto.BalanceListDto">
|
||||
select
|
||||
a.miner_user `user`,
|
||||
b.balance address,
|
||||
b.amount amount
|
||||
from
|
||||
user_account_balance b
|
||||
left join user_miner_account a on b.ma_id = a.id
|
||||
where
|
||||
a.coin= #{coin}
|
||||
and b.active = 0
|
||||
and b.status = 0
|
||||
and a.status = 0
|
||||
</select>
|
||||
|
||||
<select id="checkKeyIfExist" resultType="java.lang.Boolean">
|
||||
select count(1) from user_page_info where url_key=#{key}
|
||||
</select>
|
||||
|
||||
<select id="getPageListByUser" resultType="com.m2pool.pool.entity.UserReadOnlyPageInfo">
|
||||
select
|
||||
id,
|
||||
url_key `key`,
|
||||
account,
|
||||
coin,
|
||||
config,
|
||||
remark,
|
||||
lang
|
||||
from
|
||||
user_page_info
|
||||
where
|
||||
`user` =#{user}
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getPageInfoByKey" resultType="com.m2pool.pool.entity.UserReadOnlyPageInfo">
|
||||
select
|
||||
id,
|
||||
`user`,
|
||||
url_key `key`,
|
||||
account,
|
||||
coin,
|
||||
config,
|
||||
remark,
|
||||
lang
|
||||
from
|
||||
user_page_info
|
||||
where
|
||||
`url_key` =#{key}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getApiKeyCountByUser" resultType="java.lang.Integer">
|
||||
select count(1) from user_api where `user`=#{user}
|
||||
</select>
|
||||
|
||||
<select id="getAPIListByUser" resultType="com.m2pool.pool.entity.UserApi">
|
||||
select
|
||||
id,
|
||||
`user`,
|
||||
api_key `key`,
|
||||
api_ip ip,
|
||||
perms
|
||||
from
|
||||
user_api
|
||||
where
|
||||
`user` =#{user}
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<select id="getAPIInfoByUserAndId" resultType="com.m2pool.pool.entity.UserApi">
|
||||
select
|
||||
id,
|
||||
`user`,
|
||||
api_key `key`,
|
||||
api_ip ip,
|
||||
perms
|
||||
from
|
||||
user_api
|
||||
where
|
||||
`user` =#{user}
|
||||
and id = #{id}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user