Files
flvx/springboot-backend/src/main/resources/mapper/ForwardMapper.xml
T
2025-11-19 14:28:45 +08:00

60 lines
1.9 KiB
XML

<?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.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.strategy AS strategy,
f.out_flow AS outFlow,
f.inx AS inx,
t.name AS tunnelName,
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.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,
f.strategy AS strategy,
f.inx AS inx,
t.name AS tunnelName,
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>