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.AssoLitigationHisFile;
import cn.cslg.report.entity.asso.AssoReportFile;
import cn.cslg.report.mapper.AssoLitigationHisFileMapper;
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 AssoLitigationHisFileService extends ServiceImpl<AssoLitigationHisFileMapper, AssoLitigationHisFile> {

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