Search in sources :

Example 6 with LabelValue

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;
}
Also used : LabelValue(com.diboot.core.vo.LabelValue) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 7 with LabelValue

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);
}
Also used : LabelValue(com.diboot.core.vo.LabelValue) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) BaseService(com.diboot.core.service.BaseService)

Aggregations

LabelValue (com.diboot.core.vo.LabelValue)7 BaseService (com.diboot.core.service.BaseService)3 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)2 BaseLoginUser (com.diboot.iam.entity.BaseLoginUser)2 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 Wrappers (com.baomidou.mybatisplus.core.toolkit.Wrappers)1 Binder (com.diboot.core.binding.Binder)1 QueryBuilder (com.diboot.core.binding.QueryBuilder)1 BindDict (com.diboot.core.binding.annotation.BindDict)1 BindingCacheManager (com.diboot.core.binding.cache.BindingCacheManager)1 PropInfo (com.diboot.core.binding.parser.PropInfo)1 Cons (com.diboot.core.config.Cons)1 AttachMoreDTO (com.diboot.core.dto.AttachMoreDTO)1 ValidList (com.diboot.core.entity.ValidList)1 BusinessException (com.diboot.core.exception.BusinessException)1 InvalidUsageException (com.diboot.core.exception.InvalidUsageException)1 DictionaryService (com.diboot.core.service.DictionaryService)1 DictionaryServiceExtProvider (com.diboot.core.service.DictionaryServiceExtProvider)1 ContextHelper (com.diboot.core.util.ContextHelper)1 S (com.diboot.core.util.S)1