diff --git a/admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/DataDictService.java b/admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/DataDictService.java index c0a47974f..6dfb57aec 100644 --- a/admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/DataDictService.java +++ b/admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/DataDictService.java @@ -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 deleteDataDict(Integer adminId, Integer dataDictId); + /** + * 获取字典值 - 单个 + * + * 注意: dictValue:Object 为了方便调用,会自动转换为 dictValue:String + * + * @param dictKey + * @param dictValue + * @return + */ CommonResult getDataDict(String dictKey, Object dictValue); + + /** + * 获取字典值 - 多个 + * + * 注意:dictValueList:? 为了方便调用,会自动转换为 Set:String + * + * @param dictKey + * @param dictValueList + * @return + */ + CommonResult> getDataDictList(String dictKey, Collection dictValueList); } diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java index 740b82d83..f15e1dde4 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/DataDictServiceImpl.java @@ -98,7 +98,7 @@ public class DataDictServiceImpl implements DataDictService { } @Override - public CommonResult> getDataDict(String dictKey, Collection dictValueList) { + public CommonResult> getDataDictList(String dictKey, Collection dictValueList) { Set convertDictValueList = dictValueList.stream().map(o -> String.valueOf(o)).collect(Collectors.toSet()); List dataDictDOList = dataDictMapper.selectByEnumValueAndValues(dictKey, convertDictValueList); List dataDictBOList = DataDictConvert.INSTANCE.convert(dataDictDOList);