package cn.cslg.report.service.business;

import cn.cslg.report.common.utils.Response;
import cn.cslg.report.entity.InvalidRecord;
import cn.cslg.report.entity.Template;
import cn.cslg.report.mapper.InvalidRecordMapper;
import cn.cslg.report.mapper.TemplateMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.io.IOException;
import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class TemplateService extends ServiceImpl<TemplateMapper, Template> {
    //根据报告类型获得模板
     public String getTemplateByType(Template template) {
         LambdaQueryWrapper<Template> wrapper =new LambdaQueryWrapper<>();
         wrapper.eq(Template::getReportType,template.getReportType());
         IPage<Template> templateIPage =this.page(new Page<>(template.getCurrent(), template.getSize()),wrapper);
       return  Response.success(templateIPage);

     }


}