package cn.cslg.report.service.business;

import cn.cslg.report.common.utils.Response;
import cn.cslg.report.entity.asso.AssoInvalidRecordFile;
import cn.cslg.report.entity.asso.AssoReportFile;
import cn.cslg.report.mapper.AssoInvalidRecordFileMapper;
import cn.cslg.report.mapper.AssoReportFileMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

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

@Service
@Slf4j
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class AssoInvalidRecordFileService extends ServiceImpl<AssoInvalidRecordFileMapper, AssoInvalidRecordFile> {

    //添加
    public String addAsso(Integer id, List<Integer> fileIds) {
        List<AssoInvalidRecordFile> tems = new ArrayList<>();
        fileIds.forEach(item -> {
            AssoInvalidRecordFile tem = new AssoInvalidRecordFile();
            tem.setInvalidId(id);
            tem.setFileId(item);
            tems.add(tem);
        });
        this.saveBatch(tems);
        return Response.success();
    }
}
