package cn.cslg.report.service.business;

import cn.cslg.report.common.utils.Response;
import cn.cslg.report.entity.asso.AssoLitigationHisFile;
import cn.cslg.report.entity.asso.AssoReportFile;
import cn.cslg.report.entity.asso.AssoReviewHisFile;
import cn.cslg.report.mapper.AssoReportFileMapper;
import cn.cslg.report.mapper.AssoReviewHisFileMapper;
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 AssoReviewHisFileService extends ServiceImpl<AssoReviewHisFileMapper, AssoReviewHisFile> {

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