package cn.iocoder.yudao.module.smartfactory.api.factoryforklift;

import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.smartfactory.api.factoryforklift.dto.FactoryForkliftDTO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryforklift.FactoryForkliftDO;
import cn.iocoder.yudao.module.smartfactory.service.factoryforklift.FactoryForkliftService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class FactoryForkliftApiImpl implements FactoryForkliftApi {

    @Resource
    private FactoryForkliftService factoryForkliftService;

    @Override
    public CommonResult<Boolean> batchSave(List<FactoryForkliftDTO> dtoList) {
        List<FactoryForkliftDO> factoryForkliftDOS = BeanUtil.copyToList(dtoList, FactoryForkliftDO.class);
        factoryForkliftService.saveBatch(factoryForkliftDOS);
        return CommonResult.success(true);
    }
}
