feat(client): 实现用户数据隔离与设备绑定优化- 添加用户会话ID构建逻辑,确保数据按用户隔离- 优化设备绑定流程,支持设备状态更新和绑定时间同步- 实现用户缓存清理功能,仅清除当前用户的数据- 增强客户端账号删除逻辑,级联删除相关数据

- 调整设备在线查询逻辑,确保只返回活跃绑定的设备
- 优化试用期逻辑,精确计算过期时间和类型- 添加账号管理弹窗和相关状态注入
-修复跟卖精灵按钮加载状态显示问题
- 增强文件上传区域UI,显示选中文件名
- 调整分页组件样式,优化界面展示效果- 优化反馈日志存储路径逻辑,默认使用用户目录
- 移除冗余代码和无用导入,提升代码整洁度
This commit is contained in:
2025-10-24 13:43:46 +08:00
parent e2a438c84e
commit 3a76aaa3c0
50 changed files with 860 additions and 590 deletions

View File

@@ -1,8 +1,6 @@
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
@@ -10,7 +8,6 @@ import java.util.Date;
*/
public class ClientAccountDevice extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private Long accountId;
private String deviceId;

View File

@@ -13,6 +13,7 @@ public interface BanmaAccountMapper {
int insert(BanmaAccount entity);
int update(BanmaAccount entity);
int deleteById(Long id);
int deleteByClientUsername(@Param("clientUsername") String clientUsername);
int clearDefault(@Param("clientUsername") String clientUsername);
}

View File

@@ -40,9 +40,19 @@ public interface ClientAccountDeviceMapper {
*/
int updateStatus(@Param("accountId") Long accountId, @Param("deviceId") String deviceId, @Param("status") String status);
/**
* 更新绑定信息
*/
int update(ClientAccountDevice binding);
/**
* 删除绑定
*/
int delete(@Param("accountId") Long accountId, @Param("deviceId") String deviceId);
/**
* 根据账号ID删除所有绑定
*/
int deleteByAccountId(@Param("accountId") Long accountId);
}

View File

@@ -45,5 +45,10 @@ public interface ClientFeedbackMapper {
* 更新反馈状态
*/
int updateFeedbackStatus(@Param("id") Long id, @Param("status") String status);
/**
* 根据用户名删除反馈
*/
int deleteFeedbackByUsername(@Param("username") String username);
}

View File

@@ -247,4 +247,12 @@ public interface ClientMonitorMapper {
* @return 在线设备列表
*/
public List<ClientDevice> selectOnlineDevices();
/**
* 根据用户名删除错误报告
*
* @param username 用户名
* @return 删除行数
*/
public int deleteErrorReportByUsername(@Param("username") String username);
}

View File

@@ -37,4 +37,9 @@ public interface RefreshTokenMapper {
* 更新令牌状态
*/
int updateRefreshToken(RefreshToken refreshToken);
/**
* 根据账号ID删除令牌
*/
int deleteByAccountId(Long accountId);
}

View File

@@ -97,6 +97,10 @@
delete from banma_account where id = #{id}
</delete>
<delete id="deleteByClientUsername">
delete from banma_account where client_username = #{clientUsername}
</delete>
</mapper>

View File

@@ -76,6 +76,18 @@
AND device_id = #{deviceId}
</update>
<!-- 更新绑定信息 -->
<update id="update" parameterType="com.ruoyi.system.domain.ClientAccountDevice">
UPDATE client_account_device
<set>
<if test="status != null">status = #{status},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if>
update_time = now()
</set>
WHERE account_id = #{accountId}
AND device_id = #{deviceId}
</update>
<!-- 删除绑定 -->
<delete id="delete">
DELETE FROM client_account_device
@@ -83,5 +95,11 @@
AND device_id = #{deviceId}
</delete>
<!-- 根据账号ID删除所有绑定 -->
<delete id="deleteByAccountId">
DELETE FROM client_account_device
WHERE account_id = #{accountId}
</delete>
</mapper>

View File

@@ -44,7 +44,11 @@
</delete>
<select id="selectOnlineDevices" resultMap="ClientDeviceMap">
SELECT * FROM client_device WHERE status = 'online' ORDER BY last_active_at DESC
SELECT d.*
FROM client_device d
INNER JOIN client_account_device ad ON d.device_id = ad.device_id
WHERE ad.status = 'active' AND d.status = 'online'
ORDER BY d.last_active_at DESC
</select>
</mapper>

View File

@@ -102,5 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteFeedbackByUsername">
delete from client_feedback where username = #{username}
</delete>
</mapper>

View File

@@ -488,5 +488,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
collect_time = NOW()
WHERE id = #{id}
</update>
<delete id="deleteErrorReportByUsername">
DELETE FROM client_error_report WHERE username = #{username}
</delete>
</mapper>

View File

@@ -63,4 +63,8 @@
where id = #{id}
</update>
<delete id="deleteByAccountId" parameterType="Long">
delete from refresh_token where account_id = #{accountId}
</delete>
</mapper>