From 5236663d1e40ca9ed0cbc0885cbc67a67c47943f Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Mon, 14 Mar 2022 16:27:23 +0800
Subject: [PATCH] screen-api            增加获取简报接口

---
 screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java
index e72937b..5806e82 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java
@@ -1,10 +1,18 @@
 package com.moral.api.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.moral.api.entity.CityAqiMonthly;
 import com.moral.api.mapper.CityAqiMonthlyMapper;
 import com.moral.api.service.CityAqiMonthlyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.moral.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +25,24 @@
 @Service
 public class CityAqiMonthlyServiceImpl extends ServiceImpl<CityAqiMonthlyMapper, CityAqiMonthly> implements CityAqiMonthlyService {
 
+    @Autowired
+    CityAqiMonthlyMapper cityAqiMonthlyMapper;
+
+    @Override
+    public List<CityAqiMonthly> getCityAqiMonthByRegionCodeAndTime(Integer regionCode, Date startDate, Date endDate) {
+        QueryWrapper<CityAqiMonthly> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("city_code",regionCode);
+        queryWrapper.between("time",startDate,endDate);
+        return cityAqiMonthlyMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    public CityAqiMonthly getCityAqiMonthByRegionCodeAndTime(Integer regionCode, Date time){
+        time = DateUtils.getFirstDayOfMonth(time);
+        QueryWrapper<CityAqiMonthly> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("city_code",regionCode);
+        queryWrapper.eq("time",time);
+        return cityAqiMonthlyMapper.selectOne(queryWrapper);
+    }
+
 }

--
Gitblit v1.8.0