package com.dy.pipIrrRemote.mqttSd1.weather; 
 | 
  
 | 
import com.dy.common.webUtil.QueryResultVo; 
 | 
import com.dy.pipIrrGlobal.daoRm.RmWeatherHistoryMapper; 
 | 
import com.dy.pipIrrGlobal.daoRm.RmWeatherLastMapper; 
 | 
import com.dy.pipIrrGlobal.voRm.VoWeather; 
 | 
import lombok.RequiredArgsConstructor; 
 | 
import lombok.extern.slf4j.Slf4j; 
 | 
import org.apache.dubbo.common.utils.PojoUtils; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.stereotype.Service; 
 | 
  
 | 
import java.util.List; 
 | 
import java.util.Map; 
 | 
  
 | 
/** 
 | 
 * @Author: liurunyu 
 | 
 * @Date: 2025/6/26 09:33 
 | 
 * @Description 
 | 
 */ 
 | 
@Slf4j 
 | 
@Service("rmWeatherSv") 
 | 
@RequiredArgsConstructor 
 | 
public class WeatherSv { 
 | 
  
 | 
    @Autowired 
 | 
    private RmWeatherHistoryMapper rmWeatherHistoryDao ; 
 | 
    @Autowired 
 | 
    private RmWeatherLastMapper rmWeatherLastDao ; 
 | 
  
 | 
    public VoWeather oneLast(Long weatherId) { 
 | 
        List<VoWeather> list = this.rmWeatherLastDao.selectSomeByWeatherId(weatherId) ; 
 | 
        if(list != null && list.size() > 0) { 
 | 
            return list.get(0) ; 
 | 
        } 
 | 
        return null ; 
 | 
    } 
 | 
  
 | 
    public QueryResultVo<List<VoWeather>> oneHistory(WeatherQo qo) { 
 | 
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); 
 | 
        Long itemTotal = rmWeatherHistoryDao.selectCount(params); 
 | 
  
 | 
        QueryResultVo<List<VoWeather>> rsVo = new QueryResultVo<>() ; 
 | 
        rsVo.pageSize = qo.pageSize ; 
 | 
        rsVo.pageCurr = qo.pageCurr ; 
 | 
  
 | 
        rsVo.calculateAndSet(itemTotal, params); 
 | 
        rsVo.obj = rmWeatherHistoryDao.selectSome(params); 
 | 
        return rsVo ; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 根据指定条件查询最新记录 
 | 
     * @param qo 
 | 
     * @return 
 | 
     */ 
 | 
    public QueryResultVo<List<VoWeather>> someLast(WeatherQo qo) { 
 | 
        qo.completionTime(); 
 | 
  
 | 
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); 
 | 
        Long itemTotal = rmWeatherLastDao.selectCount(params); 
 | 
  
 | 
        QueryResultVo<List<VoWeather>> rsVo = new QueryResultVo<>() ; 
 | 
        rsVo.pageSize = qo.pageSize ; 
 | 
        rsVo.pageCurr = qo.pageCurr ; 
 | 
  
 | 
        rsVo.calculateAndSet(itemTotal, params); 
 | 
        rsVo.obj = rmWeatherLastDao.selectSome(params); 
 | 
        return rsVo ; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 根据指定条件查询历史记录 
 | 
     * @param qo 
 | 
     * @return 
 | 
     */ 
 | 
    public QueryResultVo<List<VoWeather>> someHistory(WeatherQo qo) { 
 | 
        qo.completionTime(); 
 | 
  
 | 
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); 
 | 
        Long itemTotal = rmWeatherHistoryDao.selectCount(params); 
 | 
  
 | 
        QueryResultVo<List<VoWeather>> rsVo = new QueryResultVo<>() ; 
 | 
        rsVo.pageSize = qo.pageSize ; 
 | 
        rsVo.pageCurr = qo.pageCurr ; 
 | 
  
 | 
        rsVo.calculateAndSet(itemTotal, params); 
 | 
        rsVo.obj = rmWeatherHistoryDao.selectSome(params); 
 | 
        return rsVo ; 
 | 
    } 
 | 
  
 | 
} 
 |