mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-02 08:56:38 +08:00
init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
username: ${DB_USER}
|
||||
password: ${DB_PASSWORD}
|
||||
hikari:
|
||||
max-lifetime: 500000
|
||||
connection-timeout: 30000
|
||||
idle-timeout: 600000
|
||||
max-pool-size: 20
|
||||
minimum-idle: 5
|
||||
pool-name: HikariCP
|
||||
auto-commit: true
|
||||
connection-test-query: SELECT 1
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 50MB
|
||||
max-request-size: 50MB
|
||||
lifecycle:
|
||||
timeout-per-shutdown-phase: 30s
|
||||
|
||||
server:
|
||||
port: 6365
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
max-thread: 800
|
||||
max-connections: 2000
|
||||
shutdown: graceful
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/**Mapper.xml
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
jwt-secret: ${JWT_SECRET}
|
||||
log-dir: ${LOG_DIR}
|
||||
server-addr: ${SERVER_ADDR}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
|
||||
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<contextName>logback</contextName>
|
||||
<springProperty scope="context" name="logDir" source="log-dir" defaultValue="logs" />
|
||||
<property name="FILE_PATH" value="${logDir}/%d{yyyy-MM-dd}.log" />
|
||||
|
||||
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--按天生成日志,即一天只生成一个文件夹和一个日志文件-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<Prudent>true</Prudent>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<FileNamePattern>${FILE_PATH}</FileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss} ^ %-5level ^ %logger{36} ^ %msg%n
|
||||
</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- logger节点,可选节点,作用是指明具体的包或类的日志输出级别,
|
||||
以及要使用的<appender>(可以把<appender>理解为一个日志模板)。
|
||||
addtivity:非必写属性,是否向上级loger传递打印信息。默认是true-->
|
||||
<logger name="com.framework.job" additivity="false">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="logFile"/>
|
||||
</logger>
|
||||
|
||||
|
||||
<!--项目的整体的日志打印级别为info-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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.admin.mapper.ForwardMapper">
|
||||
|
||||
<!-- 查询所有转发信息(包含隧道信息) -->
|
||||
<select id="selectAllForwardsWithTunnel" resultType="com.admin.common.dto.ForwardWithTunnelDto">
|
||||
SELECT
|
||||
f.id,
|
||||
f.user_id AS userId,
|
||||
f.name,
|
||||
f.tunnel_id AS tunnelId,
|
||||
f.in_port AS inPort,
|
||||
f.out_port AS outPort,
|
||||
f.remote_addr AS remoteAddr,
|
||||
f.status,
|
||||
f.created_time AS createdTime,
|
||||
f.updated_time AS updatedTime,
|
||||
f.user_name AS userName,
|
||||
f.in_flow AS inFlow,
|
||||
f.out_flow AS outFlow,
|
||||
t.name AS tunnelName,
|
||||
t.in_ip AS inIp,
|
||||
t.in_port_sta AS inPortSta,
|
||||
t.in_port_end AS inPortEnd,
|
||||
t.out_ip AS outIp,
|
||||
t.out_ip_sta AS outIpSta,
|
||||
t.out_ip_end AS outIpEnd,
|
||||
t.type
|
||||
FROM
|
||||
forward f
|
||||
LEFT JOIN
|
||||
tunnel t ON f.tunnel_id = t.id
|
||||
ORDER BY
|
||||
f.created_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询转发信息(包含隧道信息) -->
|
||||
<select id="selectForwardsWithTunnelByUserId" resultType="com.admin.common.dto.ForwardWithTunnelDto">
|
||||
SELECT
|
||||
f.id,
|
||||
f.user_id AS userId,
|
||||
f.name,
|
||||
f.tunnel_id AS tunnelId,
|
||||
f.in_port AS inPort,
|
||||
f.out_port AS outPort,
|
||||
f.remote_addr AS remoteAddr,
|
||||
f.status,
|
||||
f.created_time AS createdTime,
|
||||
f.updated_time AS updatedTime,
|
||||
f.user_name AS userName,
|
||||
f.in_flow AS inFlow,
|
||||
f.out_flow AS outFlow,
|
||||
t.name AS tunnelName,
|
||||
t.in_ip AS inIp,
|
||||
t.in_port_sta AS inPortSta,
|
||||
t.in_port_end AS inPortEnd,
|
||||
t.out_ip AS outIp,
|
||||
t.out_ip_sta AS outIpSta,
|
||||
t.out_ip_end AS outIpEnd,
|
||||
t.type
|
||||
FROM
|
||||
forward f
|
||||
LEFT JOIN
|
||||
tunnel t ON f.tunnel_id = t.id
|
||||
WHERE
|
||||
f.user_id = #{userId}
|
||||
ORDER BY
|
||||
f.created_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.admin.mapper.NodeMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.admin.mapper.SpeedLimitMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.admin.mapper.TunnelMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?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.admin.mapper.UserMapper">
|
||||
|
||||
<!-- 查询用户隧道权限详情(连表查询隧道和限速规则信息) -->
|
||||
<select id="getUserTunnelDetails" resultType="com.admin.common.dto.UserPackageDto$UserTunnelDetailDto">
|
||||
SELECT
|
||||
ut.id,
|
||||
ut.user_id as userId,
|
||||
ut.tunnel_id as tunnelId,
|
||||
t.name as tunnelName,
|
||||
t.flow as tunnelFlow,
|
||||
ut.flow,
|
||||
ut.in_flow as inFlow,
|
||||
ut.out_flow as outFlow,
|
||||
ut.num,
|
||||
ut.flow_reset_time as flowResetTime,
|
||||
ut.exp_time as expTime,
|
||||
ut.speed_id as speedId,
|
||||
sl.name as speedLimitName,
|
||||
sl.speed
|
||||
FROM user_tunnel ut
|
||||
LEFT JOIN tunnel t ON ut.tunnel_id = t.id
|
||||
LEFT JOIN speed_limit sl ON ut.speed_id = sl.id
|
||||
WHERE ut.user_id = #{userId}
|
||||
ORDER BY ut.id
|
||||
</select>
|
||||
|
||||
<!-- 查询用户转发详情(连表查询隧道信息) -->
|
||||
<select id="getUserForwardDetails" resultType="com.admin.common.dto.UserPackageDto$UserForwardDetailDto">
|
||||
SELECT
|
||||
f.id,
|
||||
f.name,
|
||||
f.tunnel_id as tunnelId,
|
||||
t.name as tunnelName,
|
||||
t.in_ip as inIp,
|
||||
f.in_port as inPort,
|
||||
f.remote_addr as remoteAddr,
|
||||
f.in_flow as inFlow,
|
||||
f.out_flow as outFlow,
|
||||
f.status,
|
||||
f.created_time as createdTime
|
||||
FROM forward f
|
||||
LEFT JOIN tunnel t ON f.tunnel_id = t.id
|
||||
WHERE f.user_id = #{userId}
|
||||
ORDER BY f.created_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 管理员查询所有隧道(流量和转发设置为99999) -->
|
||||
<select id="getAllTunnelsForAdmin" resultType="com.admin.common.dto.UserPackageDto$UserTunnelDetailDto">
|
||||
SELECT
|
||||
t.id,
|
||||
0 as userId,
|
||||
t.id as tunnelId,
|
||||
t.name as tunnelName,
|
||||
t.flow as tunnelFlow,
|
||||
99999 as flow,
|
||||
0 as inFlow,
|
||||
0 as outFlow,
|
||||
99999 as num,
|
||||
null as flowResetTime,
|
||||
null as expTime,
|
||||
null as speedId,
|
||||
'无限制' as speedLimitName,
|
||||
null as speed
|
||||
FROM tunnel t
|
||||
WHERE t.status = 1
|
||||
ORDER BY t.id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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.admin.mapper.UserTunnelMapper">
|
||||
|
||||
<!-- 获取用户隧道权限及隧道详细信息 -->
|
||||
<select id="getUserTunnelWithDetails" resultType="com.admin.common.dto.UserTunnelWithDetailDto">
|
||||
SELECT
|
||||
ut.id,
|
||||
ut.user_id as userId,
|
||||
ut.tunnel_id as tunnelId,
|
||||
ut.flow,
|
||||
ut.in_flow as inFlow,
|
||||
ut.out_flow as outFlow,
|
||||
ut.num,
|
||||
ut.flow_reset_time as flowResetTime,
|
||||
ut.exp_time as expTime,
|
||||
ut.speed_id as speedId,
|
||||
t.name as tunnelName,
|
||||
t.flow as tunnelFlow,
|
||||
t.in_ip as inIp,
|
||||
t.in_port_sta as inPortSta,
|
||||
t.in_port_end as inPortEnd,
|
||||
t.out_ip as outIp,
|
||||
t.out_ip_sta as outIpSta,
|
||||
t.out_ip_end as outIpEnd,
|
||||
t.type,
|
||||
sl.name as speedLimitName,
|
||||
sl.speed
|
||||
FROM user_tunnel ut
|
||||
LEFT JOIN tunnel t ON ut.tunnel_id = t.id
|
||||
LEFT JOIN speed_limit sl ON ut.speed_id = sl.id
|
||||
WHERE ut.user_id = #{userId}
|
||||
ORDER BY ut.id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user