Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分布式独立数据源 dictTable #5643

Closed
pljay opened this issue Dec 7, 2023 · 6 comments
Closed

分布式独立数据源 dictTable #5643

pljay opened this issue Dec 7, 2023 · 6 comments

Comments

@pljay
Copy link

pljay commented Dec 7, 2023

版本号:3.4.3
前端版本:vue2
问题描述:分布式独立数据源dictTable,无法实现当前服务 表翻译,jeecg-system 不存在此表,能否有办法实现翻译功能
截图&代码:

image

友情提示(为了提高issue处理效率):

  • 未按格式要求发帖,会被直接删掉;
  • 描述过于简单或模糊,导致无法处理的,会被直接删掉;
  • 请自己初判问题描述是否清楚,是否方便我们调查处理;
  • 针对问题请说明是Online在线功能(需说明用的主题模板),还是生成的代码功能;
@hutianxi
Copy link

hutianxi commented Dec 8, 2023

@dict(dictTable = "ku.biao", dicText = "fanyi", dicCode = "id") "库".表 这样写试一下呢

@EightMonth
Copy link
Contributor

参考此文档
https://help.jeecg.com/java/java/annotation.html

@zhangdaiscott
Copy link
Member

你可以扩展下这个字典注解

1、字典注解加一个参数 数据源key

对应配置多数据源
image

2、扩展字典拦截器,判断有数据源key注解,自动切换数据源
org\jeecg\common\aspect\DictAspect.java

3、如何切换数据源,参考
src/main/java/org/jeecg/config/mybatis/interceptor/DynamicDatasourceInterceptor.java

@pljay
Copy link
Author

pljay commented Dec 13, 2023

@dict(dictTable = "ku.biao", dicText = "fanyi", dicCode = "id") "库".表 这样写试一下呢

必须是同源数据库

@pljay
Copy link
Author

pljay commented Dec 13, 2023

你可以扩展下这个字典注解

1、字典注解加一个参数 数据源key

对应配置多数据源 image

2、扩展字典拦截器,判断有数据源key注解,自动切换数据源 org\jeecg\common\aspect\DictAspect.java

3、如何切换数据源,参考 src/main/java/org/jeecg/config/mybatis/interceptor/DynamicDatasourceInterceptor.java

我试一下,这种方式

@zhangdaiscott
Copy link
Member

cr

hoperunChen pushed a commit to hoperunChen/jeecg-boot that referenced this issue Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants