package com.jiayue.passback.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.passback.entity.WeatherStationInfo;
import com.jiayue.passback.mapper.WeatherStationInfoMapper;
import com.jiayue.passback.service.WeatherStationInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeatherStationInfoServiceImpl extends ServiceImpl<WeatherStationInfoMapper, WeatherStationInfo> implements WeatherStationInfoService {
    @Override
    public int weatherStationInfoId() {
        int id = 0;

        List<WeatherStationInfo> weatherStationInfoList = list(lambdaQuery().eq(WeatherStationInfo::getReport, true).getWrapper());

        if (weatherStationInfoList.size() > 0) {
            id = weatherStationInfoList.get(0).getId();
        }

        return id;
    }
}
