whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/service/BattmonTestcapService.java
@@ -5,6 +5,7 @@
import com.whyc.mapper.BattmonTestcapMapper;
import com.whyc.pojo.BattmonStandardcurve;
import com.whyc.pojo.BattmonTestcap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -17,6 +18,9 @@
    @Resource
    private BattmonStandardcurveMapper standatmapper;
    @Autowired
    private SubTablePageInfoService subService;
    //添加标准曲线
    public Response add(BattmonTestcap btcp) {
        BattmonStandardcurve bsd=new BattmonStandardcurve();
@@ -25,7 +29,9 @@
        bsd.setBattproducer(btcp.getBattproducer());
        bsd.setBattmodel(btcp.getBattmodel());
        bsd.setNote(btcp.getNote());
        if(Integer.valueOf(btcp.getNote())<=0){
            return  new Response().set(1,false,"小时率小于等于0,无法添加小时率");
        }
        //查询前先创建数据库
        standatmapper.create_standard_curve();
        //先判断是否存在曲线记录库
@@ -34,13 +40,21 @@
            standatmapper.add(bsd);
        }
        String table_name="tb_battmon_testcap_"+(int)btcp.getMonvolstd()+"_"+(int)btcp.getMoncapstd()+"_"+btcp.getNote();
        mapper.create_standard_curve(table_name);
        //mapper.create_standard_curve(table_name);
        subService.create_standard_curve(table_name);
        //每次增加标准曲线库前要清理曲线库
        btcp.setTableName(table_name);
        mapper.del(btcp);
            //增加曲线
        int flag=mapper.add(btcp);
        //mapper.del(btcp);
        subService.del(btcp);
        //增加曲线
        //int flag=mapper.add(btcp);
        int flag=subService.add(btcp);
        return new Response().set(flag>0?1:0);
    }
    public List<BattmonTestcap> getTestCapList(BattmonStandardcurve curve) {
        //return mapper.getTestCapList(curve);
        return subService.getTestCapList(curve);
    }
}