//package com.org.hktshop.utils;
//
//import com.org.hktshop.Interface.brand.IHktBrandDescService;
//import com.org.hktshop.Interface.product.IHktGoodsCategoryService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import java.util.*;
//import java.util.stream.Collectors;
//
//@Component
//public class DataDictUtils {
//    @Autowired
//    private IHktGoodsCategoryService hktGoodsCategoryService;
//
//    @Autowired
//    private IHktBrandDescService hktBrandDescService;
//    private static Logger logger = LoggerFactory.getLogger(DataDictUtils.class);
//
////    public List<Map<String, String>> getObjByIds(Set deptIds, int type) {
////        logger.info("对象ids集合参数: " + deptIds.toString());
////        List<Map<String, String>> list = new ArrayList<>();
////        switch (type) {
////            //分类信息
////            case 1:
////                list.addAll(hktGoodsCategoryService.selectCategoryByIds(deptIds));
////                break;
////            //品牌
////            case 2:
////                list.addAll(hktBrandDescService.selectBiandDescByIds(deptIds));
////                break;
////            //主题
////            default:
//////                result = list.addAll(hktBrandDescService.selectBiandDescByIds(deptIds));
////                break;
////        }
////        return list;
////    }
//
//    /**
//     * @param object 对象集合
//     * @param type   1:用户信息 2:品牌
//     * @return
//     */
////    public List<Map> fillMap(Object object, int type) {
////        if (object == null) {
////            return null;
////        }
////        List<Map<String, Object>> resultList;
////        if (object instanceof List) {
////            resultList = (List<Map<String, Object>>) object;
////        } else {
////            resultList = new ArrayList<>();
////            resultList.add((Map<String, Object>) object);
////        }
////        String target;
////        String current;
////        switch (type) {
////            //分类
////            case 1:
////                target = "nameCh";
////                current = "categoryId";
////                break;
////            //品牌
////            case 2:
////                target = "name";
////                current = "brandId";
////                break;
////            default:
////                target = "name";
////                current = "brandId";
////                break;
////        }
////        //查询分类id集合
////        Set<Object> idlist = resultList.stream().map(ct -> ct.get(current)).collect(Collectors.toSet());
////
////        List<Map<String, String>> userList = getObjByIds(idlist, type);
////        List<Map> resultCollect = resultList.stream().map(result -> {
////            Optional<String> userName = userList.stream()
////                    .filter(user -> result.get(current).toString().equals(user.get("id")))
////                    .map(user -> user.get(target)).findFirst();
////            if (userName.isPresent()) {
////                result.put(current, userName.get());
////            }
////            return result;
////        }).collect(Collectors.toList());
////        return resultCollect;
////    }
//}