whycrzg
2021-01-29 0f24731e84183146193ed19d1a51f7f63a98cd1a
src/main/java/com/fgkj/services/Batt_rtService.java
@@ -1,32 +1,40 @@
package com.fgkj.services;
import com.fgkj.dto.Batt_rtdata;
import com.fgkj.dto.Batt_rtstate;
import com.fgkj.dto.ServiceModel;
import com.fgkj.mapper.impl.Batt_rtMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
 * @Description :电池实时数据,同时需要电池组/电池时使用
 * @date 2020/09/04
 **/
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
@Service
public class Batt_rtService {
    @Resource
    private Batt_rtMapper battRtDao;
    private ServiceModel serviceModel;
    public ServiceModel searchByGroupId(int groupId) {
        Map map =battRtDao.searchByGroupId(groupId);
        if(map!=null && !map.isEmpty()){
            serviceModel.code=1;
            serviceModel.data=map;
    public ServiceModel searchByGroupId(int battGroupId) {
        ServiceModel model = new ServiceModel();
        Map map = new HashMap();
        LinkedList<Batt_rtstate> listbt = battRtDao.searchByGroupId(battGroupId);
        if (listbt != null && !listbt.isEmpty()) {
            listbt.get(0);
            map.put("rtState", listbt);
//            System.out.println("listbt = " + listbt);
        }
        return serviceModel;
        LinkedList<Batt_rtdata> listbd = battRtDao.searchByGroupId2(battGroupId);
        if (listbd != null && !listbd.isEmpty()) {
            map.put("rtDatas", listbd);
//            System.out.println("listbd = " + listbd);
        }
        //将两个数据结果放置到map中
        if (!map.isEmpty()) {
            model.setCode(1);
            model.setData(map);
        }
        return model;
    }
}