whyclxw
2022-01-17 d643e8efd0a726050a28cdc4e908b9113e5ee00d
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
package com.whyc.service;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.BattRealdataMapper;
import com.whyc.pojo.BattRealdata;
import com.whyc.util.ActionUtil;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
 
@Service
public class BattRealdataService {
    @Resource
    private BattRealdataMapper mapper;
    //查询历史实时数据
    public Response serchByCondition(BattRealdata realdata) {
        String table=realdata.getBattGroupId()+"_"+ActionUtil.sdfwithOutday.format(realdata.getRecrodTime());
        realdata.setNote(table);//表名时间格式部分
        //判断表是否存在
        int tableNum=mapper.judgeTable(table);
        List<BattRealdata> list=new ArrayList();
        if(tableNum>0){
            list=mapper.serchByCondition(realdata);
        }
        PageInfo pageInfo=new PageInfo(list);
        return new Response().set(1,pageInfo);
    }
}