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

import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.smartfactory.api.linefixedassets.dto.LineFixedAssetsDTO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.linefixedassets.LineFixedAssetsDO;
import cn.iocoder.yudao.module.smartfactory.service.linefixedassets.LineFixedAssetsService;
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 LineFixedAssetsApiImpl implements LineFixedAssetsApi {

    @Resource
    private LineFixedAssetsService lineFixedAssetsService;

    @Override
    public CommonResult<Boolean> batchSave(List<LineFixedAssetsDTO> dtoList) {
        List<LineFixedAssetsDO> list = BeanUtil.copyToList(dtoList, LineFixedAssetsDO.class);
        lineFixedAssetsService.saveBatch(list);
        return CommonResult.success(true);
    }
}
