refactor(role): 使用 RedisTemplate 替换 StringRedisTemplate 优化角色数据同步

- 将 RoleServiceImpl 中 stringRedisTemplate 替换为更通用的 redisTemplate
- 调整角色和用户角色关系写入 Redis 的代码,删除存储过期时间参数
- 添加日志记录,输出同步到 Redis 的用户角色关系数据
- 删除 LoginServiceImpl 中未实现的 initUserRole 方法
- 新增 RoleService 的单元测试 RoleTest,验证角色权限同步功能
- 移除 UserRoleRelDOMapper.xml 中 selectAll 查询的 is_deleted 过滤条件
This commit is contained in:
lbw
2025-12-24 15:35:23 +08:00
parent 260c2c79f1
commit 15e909c318
4 changed files with 26 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
package com.yinlihupo.enlish.service.service.role;
import com.yinlihupo.enlish.service.service.RoleService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
@Slf4j
public class RoleTest {
@Resource
private RoleService roleService;
@Test
public void test() {
log.info("==> 测试");
roleService.pushRolePermission2Redis();
}
}