fit:增加数据字典对外接口
This commit is contained in:
parent
1d250e979a
commit
acbb57fd9d
|
|
@ -84,6 +84,16 @@ public class SysDictDataController extends BaseController
|
||||||
return success(data);
|
return success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和值获取字典标签
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/label/{dictType}/{dictValue}")
|
||||||
|
public AjaxResult dictLabel(@PathVariable String dictType, @PathVariable String dictValue)
|
||||||
|
{
|
||||||
|
String label = dictTypeService.selectDictLabel(dictType, dictValue);
|
||||||
|
return success(label);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,15 @@ public interface ISysDictTypeService
|
||||||
*/
|
*/
|
||||||
public List<SysDictData> selectDictDataByType(String dictType);
|
public List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
public String selectDictLabel(String dictType, String dictValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型ID查询信息
|
* 根据字典类型ID查询信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,31 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String selectDictLabel(String dictType, String dictValue)
|
||||||
|
{
|
||||||
|
// 从缓存查询
|
||||||
|
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);;
|
||||||
|
if (StringUtils.isNotEmpty(dictDatas))
|
||||||
|
{
|
||||||
|
for (SysDictData dictData : dictDatas)
|
||||||
|
{
|
||||||
|
if (dictValue.equals(dictData.getDictValue()))
|
||||||
|
{
|
||||||
|
return dictData.getDictLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dictValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型ID查询信息
|
* 根据字典类型ID查询信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue