whycxzp
7 天以前 2205305e5be09c54dcaa3638f9412227cb3b9e7e
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
package com.whyc.service;
 
import com.whyc.dto.Response;
import com.whyc.mapper.CommonMapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class BatttestdataIdService {
    @Autowired
    private SubTablePageInfoService subTablePageInfoService;
    @Resource
    private CommonMapper commonMapper;
 
    //找这次放电的指定的一笔数据
    public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) {
        List<BatttestdataId> list=subTablePageInfoService.getLastDataByBattgroupId(battgroupId,  testRecordCount, recordNum);
        return list;
    }
    //历史测试记录具体某一次放电数据详情
    public Response getTinfDataWithTestRecordCount(Integer battgroupId, Integer testRecordCount,Integer recordNum, Integer granularity) {
        String tableName ="db_batt_testdata.tb_batttestdata_"+battgroupId;
        String existTableName = commonMapper.existTable("db_batt_testdata", "tb_batttestdata_"+battgroupId);
        if(existTableName == null){
            return new Response().set(1,false,battgroupId+"电池组找不到第"+testRecordCount+"次放电记录");
        }
        List<BatttestdataId> list=subTablePageInfoService.getTinfDataWithTestRecordCount(tableName,testRecordCount,recordNum,granularity);
        return new Response().setII(1,list.size()>0,list,"获取历史测试记录数据详情");
    }
}