whyclxw
6 天以前 5720a0b6cb13fcecc7fb810c7a7f0ad124ce6048
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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<QuarterDto> 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<QuarterDto> list=subTablePageInfoService.getBattResInfData(battgroupId,rinf.getTestRecordCount());
                return list;
            }
        }
        return null;
    }
}