use of com.diboot.core.vo.LabelValue in project diboot by dibo-software.
the class ExcelBindAnnoHandler method convertLabelValueListToMap.
/**
* 转换列表为map
* @param list
* @return
*/
private static Map<String, List> convertLabelValueListToMap(List<LabelValue> list) {
Map<String, List> resultMap = new HashMap<>(list.size());
if (V.notEmpty(list)) {
for (LabelValue labelValue : list) {
List mapVal = resultMap.get(labelValue.getLabel());
if (mapVal == null) {
mapVal = new ArrayList();
resultMap.put(labelValue.getLabel(), mapVal);
}
if (!mapVal.contains(labelValue.getValue())) {
mapVal.add(labelValue.getValue());
}
}
}
return resultMap;
}
use of com.diboot.core.vo.LabelValue in project diboot by dibo-software.
the class ExcelBindAnnoHandler method executeBindField.
/**
* 执行绑定
* @param bindField
* @param nameList
* @return
*/
private static Map<String, List> executeBindField(ExcelBindField bindField, List<String> nameList) {
if (V.isEmpty(nameList)) {
return Collections.emptyMap();
}
BaseService service = ContextHelper.getBaseServiceByEntity(bindField.entity());
String nameColumn = S.toSnakeCase(bindField.field());
String idColumn = ContextHelper.getIdColumnName(bindField.entity());
QueryWrapper queryWrapper = Wrappers.query().select(nameColumn, idColumn).in(nameColumn, nameList);
List<LabelValue> list = service.getLabelValueList(queryWrapper);
return convertLabelValueListToMap(list);
}
Aggregations