mirror of https://gitee.com/stylefeng/roses
【8.1.7】【dict】增加一个获取字典名称的方法
parent
85a32734de
commit
1e3f39c155
|
@ -39,6 +39,17 @@ import java.util.List;
|
|||
*/
|
||||
public interface DictApi {
|
||||
|
||||
/**
|
||||
* 通过字典类型编码和字典编码获取名称
|
||||
*
|
||||
* @param dictTypeId 字典类型id
|
||||
* @param dictCode 字典编码
|
||||
* @return 字典名称
|
||||
* @author fengshuonan
|
||||
* @since 2024/5/9 0:12
|
||||
*/
|
||||
String getDictName(Long dictTypeId, String dictCode);
|
||||
|
||||
/**
|
||||
* 通过字典类型编码和字典编码获取名称
|
||||
*
|
||||
|
|
|
@ -200,6 +200,20 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
|||
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
|
||||
public String getDictName(String dictTypeCode, String dictCode) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue