parent
fdc6c89bc2
commit
234f74f8f0
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.common.core.service;
|
||||
|
||||
/**
|
||||
* 通用 部门服务
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface DeptService {
|
||||
|
||||
/**
|
||||
* 通过部门ID查询部门名称
|
||||
*
|
||||
* @param deptIds 部门ID串逗号分隔
|
||||
* @return 部门名称串逗号分隔
|
||||
*/
|
||||
String selectDeptNameByIds(String deptIds);
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.common.translation.core.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.DeptService;
|
||||
import com.ruoyi.common.translation.annotation.TranslationType;
|
||||
import com.ruoyi.common.translation.constant.TransConstant;
|
||||
import com.ruoyi.common.translation.core.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 部门翻译实现
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@TranslationType(type = TransConstant.DEPT_ID_TO_NAME)
|
||||
public class DeptNameTranslationImpl implements TranslationInterface {
|
||||
|
||||
private final DeptService deptService;
|
||||
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof String ids) {
|
||||
return deptService.selectDeptNameByIds(ids);
|
||||
} else if (key instanceof Long id) {
|
||||
return deptService.selectDeptNameByIds(id.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue