package com.whyc.service;
|
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.BattmonStandardcurveMapper;
|
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;
|
import java.util.List;
|
|
@Service
|
public class BattmonTestcapService {
|
@Resource
|
private BattmonTestcapMapper mapper;
|
@Resource
|
private BattmonStandardcurveMapper standatmapper;
|
|
@Autowired
|
private SubTablePageInfoService subService;
|
|
//添加标准曲线
|
public Response add(BattmonTestcap btcp) {
|
BattmonStandardcurve bsd=new BattmonStandardcurve();
|
bsd.setMonvolstd(btcp.getMonvolstd());
|
bsd.setMoncapstd(btcp.getMoncapstd());
|
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();
|
//先判断是否存在曲线记录库
|
int number=standatmapper.serchRecord(bsd);
|
if(number<=0){
|
standatmapper.add(bsd);
|
}
|
String table_name="tb_battmon_testcap_"+(int)btcp.getMonvolstd()+"_"+(int)btcp.getMoncapstd()+"_"+btcp.getNote();
|
//mapper.create_standard_curve(table_name);
|
subService.create_standard_curve(table_name);
|
//每次增加标准曲线库前要清理曲线库
|
btcp.setTableName(table_name);
|
//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);
|
}
|
}
|