Commit 5c03b977752b9b8d40fd3bc05ef3b79d12a23d63

Authored by YunaiV
1 parent 73e30a4f

增加一些多租户相关的注释,更加清晰一些~

yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisKeyDefine.java
@@ -9,12 +9,12 @@ import java.time.Duration; @@ -9,12 +9,12 @@ import java.time.Duration;
9 /** 9 /**
10 * 多租户拓展的 RedisKeyDefine 实现类 10 * 多租户拓展的 RedisKeyDefine 实现类
11 * 11 *
12 - * 由于 Redis 不同于 MySQL 有 column 字段,所以无法通过类似 WHERE tenant_id = ? 的方式过滤 12 + * 由于 Redis 不同于 MySQL 有 column 字段,无法通过类似 WHERE tenant_id = ? 的方式过滤
13 * 所以需要通过在 Redis Key 上增加后缀的方式,进行租户之间的隔离。具体的步骤是: 13 * 所以需要通过在 Redis Key 上增加后缀的方式,进行租户之间的隔离。具体的步骤是:
14 * 1. 假设 Redis Key 是 user:%d,示例是 user:1;对应到多租户的 Redis Key 是 user:%d:%d, 14 * 1. 假设 Redis Key 是 user:%d,示例是 user:1;对应到多租户的 Redis Key 是 user:%d:%d,
15 * 2. 在 Redis DAO 中,需要使用 {@link #formatKey(Object...)} 方法,进行 Redis Key 的格式化 15 * 2. 在 Redis DAO 中,需要使用 {@link #formatKey(Object...)} 方法,进行 Redis Key 的格式化
16 * 16 *
17 - * 注意,大多数情况下,并不用使用 TenantRedisKeyDefine 实现。主要的使用场景,是 Redis Key 可能存在冲突的情况。 17 + * 注意,大多数情况下,并不用使用 TenantRedisKeyDefine 实现。主要的使用场景,还是 Redis Key 可能存在冲突的情况。
18 * 例如说,租户 1 和 2 都有一个手机号作为 Key,则他们会存在冲突的问题 18 * 例如说,租户 1 和 2 都有一个手机号作为 Key,则他们会存在冲突的问题
19 * 19 *
20 * @author 芋道源码 20 * @author 芋道源码
yudao-server/src/main/resources/application.yaml
@@ -88,13 +88,13 @@ yudao: @@ -88,13 +88,13 @@ yudao:
88 - cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants 88 - cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants
89 - cn.iocoder.yudao.module.system.enums.ErrorCodeConstants 89 - cn.iocoder.yudao.module.system.enums.ErrorCodeConstants
90 - cn.iocoder.yudao.module.tool.enums.ErrorCodeConstants 90 - cn.iocoder.yudao.module.tool.enums.ErrorCodeConstants
91 - tenant: # 多租户相关配置项 91 + : # 多租户相关配置项
92 enable: true 92 enable: true
93 ignore-urls: 93 ignore-urls:
94 - - /admin-api/system/tenant/get-id-by-name  
95 - - /admin-api/system/captcha/get-image  
96 - - /admin-api/infra/file/get/*  
97 - - /admin-api/system/sms/callback/* 94 + - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
  95 + - /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关
  96 + - /admin-api/infra/file/get/* # 获取图片,和租户无关
  97 + - /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号
98 ignore-tables: 98 ignore-tables:
99 - infra_config 99 - infra_config
100 - infra_file 100 - infra_file