【8.1.7】【dict】增加一个获取字典名称的方法

dev-8.1.9
fengshuonan 2024-05-09 00:19:04 +08:00
parent 85a32734de
commit 1e3f39c155
2 changed files with 25 additions and 0 deletions

View File

@ -39,6 +39,17 @@ import java.util.List;
*/ */
public interface DictApi { public interface DictApi {
/**
*
*
* @param dictTypeId id
* @param dictCode
* @return
* @author fengshuonan
* @since 2024/5/9 0:12
*/
String getDictName(Long dictTypeId, String dictCode);
/** /**
* *
* *

View File

@ -200,6 +200,20 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
this.updateBatchById(totalDictList); this.updateBatchById(totalDictList);
} }
@Override
public String getDictName(Long dictTypeId, String dictCode) {
LambdaQueryWrapper<SysDict> sysDictLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysDictLambdaQueryWrapper.eq(SysDict::getDictTypeId, dictTypeId);
sysDictLambdaQueryWrapper.eq(SysDict::getDictCode, dictCode);
sysDictLambdaQueryWrapper.select(SysDict::getDictName);
SysDict sysDict = this.getOne(sysDictLambdaQueryWrapper, false);
if (ObjectUtil.isEmpty(sysDict)) {
return "";
}
return sysDict.getDictName();
}
@Override @Override
public String getDictName(String dictTypeCode, String dictCode) { public String getDictName(String dictTypeCode, String dictCode) {