leniu-architecture-design
Installation
SKILL.md
leniu-tengyun-core 架构设计指南
双库架构
物理分离双库,Entity 无 tenant_id 字段:
| 库类型 | 数据范围 | 访问方式 |
|---|---|---|
| 系统库 | 租户信息、商户配置、系统字典 | Executors.doInSystem() |
| 商户库 | 订单、菜品、用户、设备等 | 默认(请求头 MERCHANT-ID) |
多租户上下文切换
// 获取当前租户
Long tenantId = TenantContextHolder.getTenantId();
// 在指定商户库执行
Executors.doInTenant(tenantId, () -> { /* 商户库 */ });
Related skills