mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25: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 需要被翻译的键(不为空)
|
* @param key 需要被翻译的键(不为空)
|
||||||
* @return 返回键对应的值
|
* @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();
|
gen.writeNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object result = trans.translation(value, translation.other());
|
Object result = trans.translate(value, translation.other());
|
||||||
gen.writeObject(result);
|
gen.writeObject(result);
|
||||||
} else {
|
} else {
|
||||||
gen.writeObject(value);
|
gen.writeObject(value);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class DeptNameTranslationImpl implements TranslationInterface<String> {
|
|||||||
private final DeptService deptService;
|
private final DeptService deptService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translation(Object key, String other) {
|
public String translate(Object key, String other) {
|
||||||
return deptService.selectDeptNameByIds(key.toString());
|
return deptService.selectDeptNameByIds(key.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class DictTypeTranslationImpl implements TranslationInterface<String> {
|
|||||||
private final DictService dictService;
|
private final DictService dictService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translation(Object key, String other) {
|
public String translate(Object key, String other) {
|
||||||
if (key instanceof String && StringUtils.isNotBlank(other)) {
|
if (key instanceof String && StringUtils.isNotBlank(other)) {
|
||||||
return dictService.getDictLabel(other, key.toString());
|
return dictService.getDictLabel(other, key.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class OssUrlTranslationImpl implements TranslationInterface<String> {
|
|||||||
private final OssService ossService;
|
private final OssService ossService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translation(Object key, String other) {
|
public String translate(Object key, String other) {
|
||||||
return ossService.selectUrlByIds(key.toString());
|
return ossService.selectUrlByIds(key.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class UserNameTranslationImpl implements TranslationInterface<String> {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translation(Object key, String other) {
|
public String translate(Object key, String other) {
|
||||||
if (key instanceof Long) {
|
if (key instanceof Long) {
|
||||||
return userService.selectUserNameById((Long) key);
|
return userService.selectUserNameById((Long) key);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user