Commit 3bc7cd75 by zhangxingmin

push

parent 30eeccad
package com.yd.user.feign.response.sysdict; package com.yd.user.feign.response.sysdict;
import lombok.Data; import lombok.Data;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 根据字典类型获取字典数据项列表出参 * 根据字典类型获取字典数据项列表出参
...@@ -52,4 +55,26 @@ public class GetDictItemListByDictTypeResponse { ...@@ -52,4 +55,26 @@ public class GetDictItemListByDictTypeResponse {
* 状态(0:停用 1:启用) * 状态(0:停用 1:启用)
*/ */
private Integer status; private Integer status;
/**
* 根据字典类型和字典值获取名称
* @param list
* @param dictType
* @param itemValue
* @return
*/
public static String getItemLabel(List<GetDictItemListByDictTypeResponse> list,
String dictType,String itemValue) {
String itemLabel = "";
if (!CollectionUtils.isEmpty(list)) {
List<GetDictItemListByDictTypeResponse> singeList = list.stream()
.filter(item -> item.getDictType().equals(dictType) && item.getItemValue().equals(itemValue))
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(singeList)) {
GetDictItemListByDictTypeResponse typeResponse = singeList.get(0);
itemLabel = typeResponse.getItemLabel();
}
}
return itemLabel;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment