package com.yc.ship.module.otc.convert.store;

import com.yc.ship.framework.common.util.collection.CollectionUtils;
import com.yc.ship.framework.common.util.collection.MapUtils;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.otc.controller.admin.store.product.StoreProductRespVO;
import com.yc.ship.module.otc.dal.dataobject.store.StoreProductDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;
import java.util.Map;

@Mapper
public interface StoreProductConvert {

    StoreProductConvert INSTANCE = Mappers.getMapper(StoreProductConvert.class);

//    default List<StoreProductRespVO> convertList(List<StoreProductDO> list, Map<Long, ProductSpuRespDTO> spuMap) {
//        return CollectionUtils.convertList(list, storeProduct -> {
//            StoreProductRespVO productVO = BeanUtils.toBean(storeProduct, StoreProductRespVO.class);
//            MapUtils.findAndThen(spuMap, storeProduct.getProductId(), spu -> productVO.setProductName(spu.getProductName()));
//            return productVO;
//        });
//    }

}
