package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.whyc.dto.Real.QuarterDto; import com.whyc.mapper.BattresdataInfMapper; import com.whyc.mapper.CommonMapper; import com.whyc.pojo.db_batt_testdata.BattresdataId; import com.whyc.pojo.db_batt_testdata.BattresdataInf; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class BattresdataInfService { @Autowired(required = false) private BattresdataInfMapper mapper; @Autowired(required = false) private SubTablePageInfoService subTablePageInfoService; @Resource private CommonMapper commonMapper; //上一次内阻测试数据 public BattresdataInf getLastTestData(Integer battgroupId) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", battgroupId); wrapper.last(" limit 1"); wrapper.last(" ORDER BY test_starttime DESC "); BattresdataInf rinf = mapper.selectOne(wrapper); return rinf; } //获取内阻初始数据(第一次内阻测试的第一笔数据) public List getFirstResData(Integer battgroupId) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", battgroupId); wrapper.last(" limit 1"); wrapper.last(" ORDER BY test_record_count asc "); BattresdataInf rinf = mapper.selectOne(wrapper); if(rinf!=null){ String tableName ="db_batt_testdata.tb_battresdata_"+battgroupId; String existTableName = commonMapper.existTable("db_batt_testdata", "tb_battresdata_"+battgroupId); if(existTableName != null){ List list=subTablePageInfoService.getBattResInfData(battgroupId,rinf.getTestRecordCount()); return list; } } return null; } }