mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 18:15:56 +08:00
Pre Merge pull request !430 from dhb52/4.X
This commit is contained in:
commit
7c3058de2b
@ -13,5 +13,5 @@ public interface TranslationInterface<T> {
|
||||
* @param key 需要被翻译的键(不为空)
|
||||
* @return 返回键对应的值
|
||||
*/
|
||||
T translation(Object key, String other);
|
||||
T translate(Object key, String other);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public class TranslationHandler extends JsonSerializer<Object> implements Contex
|
||||
gen.writeNull();
|
||||
return;
|
||||
}
|
||||
Object result = trans.translation(value, translation.other());
|
||||
Object result = trans.translate(value, translation.other());
|
||||
gen.writeObject(result);
|
||||
} else {
|
||||
gen.writeObject(value);
|
||||
|
||||
@ -20,7 +20,7 @@ public class DeptNameTranslationImpl implements TranslationInterface<String> {
|
||||
private final DeptService deptService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
public String translate(Object key, String other) {
|
||||
return deptService.selectDeptNameByIds(key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class DictTypeTranslationImpl implements TranslationInterface<String> {
|
||||
private final DictService dictService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
public String translate(Object key, String other) {
|
||||
if (key instanceof String && StringUtils.isNotBlank(other)) {
|
||||
return dictService.getDictLabel(other, key.toString());
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ public class OssUrlTranslationImpl implements TranslationInterface<String> {
|
||||
private final OssService ossService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
public String translate(Object key, String other) {
|
||||
return ossService.selectUrlByIds(key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ public class UserNameTranslationImpl implements TranslationInterface<String> {
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
public String translate(Object key, String other) {
|
||||
if (key instanceof Long) {
|
||||
return userService.selectUserNameById((Long) key);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user