package com.zt.plat.module.base.api.internalsupplyfactory;

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.api.InternalSupplyFactoryApi;
import com.zt.plat.module.api.dto.internalsupplyfactory.InternalSupplyFactoryDTO;
import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO;
import com.zt.plat.module.base.service.internalsupplyfactory.InternalSupplyFactoryService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@Validated
public class InternalSupplyFactoryImpl  implements InternalSupplyFactoryApi {
    @Resource
    private InternalSupplyFactoryService internalSupplyFactoryService;
    @Override
    public CommonResult<List<InternalSupplyFactoryDTO>> batchCreate(List<InternalSupplyFactoryDTO> reqVOS) {
        List<InternalSupplyFactoryDO> factoryDOS =new ArrayList<>();
        for (InternalSupplyFactoryDTO reqVO : reqVOS) {
            InternalSupplyFactoryDO factoryDO = BeanUtils.toBean(reqVO, InternalSupplyFactoryDO.class);
            factoryDO.setCompanyIdCustom(reqVO.getErpCompanyNumber());
            factoryDO.setCompanyNameCustom(reqVO.getErpCompanyName());
            factoryDOS.add(factoryDO);
        }
        //internalSupplyFactoryService.bindFactory(factoryDOS);
        return null;
    }
}
