- 重命名获取多个字典值方法

This commit is contained in:
sin 2019-04-16 20:20:24 +08:00
parent a765b2c233
commit d30aeea6ab
2 changed files with 22 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import cn.iocoder.mall.admin.api.bo.DataDictBO;
import cn.iocoder.mall.admin.api.dto.DataDictAddDTO;
import cn.iocoder.mall.admin.api.dto.DataDictUpdateDTO;
import java.util.Collection;
import java.util.List;
public interface DataDictService {
@ -17,5 +18,25 @@ public interface DataDictService {
CommonResult<Boolean> deleteDataDict(Integer adminId, Integer dataDictId);
/**
* 获取字典值 - 单个
*
* 注意: dictValue:Object 为了方便调用会自动转换为 dictValue:String
*
* @param dictKey
* @param dictValue
* @return
*/
CommonResult<DataDictBO> getDataDict(String dictKey, Object dictValue);
/**
* 获取字典值 - 多个
*
* 注意dictValueList:? 为了方便调用会自动转换为 Set:String
*
* @param dictKey
* @param dictValueList
* @return
*/
CommonResult<List<DataDictBO>> getDataDictList(String dictKey, Collection<?> dictValueList);
}

View File

@ -98,7 +98,7 @@ public class DataDictServiceImpl implements DataDictService {
}
@Override
public CommonResult<List<DataDictBO>> getDataDict(String dictKey, Collection<Object> dictValueList) {
public CommonResult<List<DataDictBO>> getDataDictList(String dictKey, Collection<?> dictValueList) {
Set<String> convertDictValueList = dictValueList.stream().map(o -> String.valueOf(o)).collect(Collectors.toSet());
List<DataDictDO> dataDictDOList = dataDictMapper.selectByEnumValueAndValues(dictKey, convertDictValueList);
List<DataDictBO> dataDictBOList = DataDictConvert.INSTANCE.convert(dataDictDOList);