From 52fe47e48341d2bfb36d6fcc6ccd95e1e90c2cd1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Mon, 2 Aug 2021 14:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BB=8A=E5=A4=A9=E7=9A=84=E7=81=AB=E7=82=B9=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=88=86=E4=B8=BA=E7=9C=81=E5=B8=82=E5=8C=BA=E4=B8=89?= =?UTF-8?q?=E7=BA=A7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/FirePointController.java | 4 ++-- src/main/java/com/xkrs/dao/FirePointDao.java | 14 ++++++++++++-- .../java/com/xkrs/service/FirePointService.java | 2 +- .../xkrs/service/impl/FirePointServiceImpl.java | 9 +++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 126e654..1187bad 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -86,10 +86,10 @@ public class FirePointController { */ @GetMapping("/selectTodayFirePoint") @PreAuthorize("hasAnyAuthority('auth_general_user')") - public String selectTodayFirePoint(@RequestHeader(value="Authorization") String token){ + public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode,@RequestHeader(value="Authorization") String token){ // 获取区域信息 Locale locale = LocaleContextHolder.getLocale(); - List firePointEntities = firePointService.selectTodayFirePoint(); + List firePointEntities = firePointService.selectTodayFirePoint(countyCode); if(firePointEntities == null || firePointEntities.size() == 0){ return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有火点数据",locale); } diff --git a/src/main/java/com/xkrs/dao/FirePointDao.java b/src/main/java/com/xkrs/dao/FirePointDao.java index 9a11d81..0e5b00b 100644 --- a/src/main/java/com/xkrs/dao/FirePointDao.java +++ b/src/main/java/com/xkrs/dao/FirePointDao.java @@ -19,10 +19,20 @@ public interface FirePointDao extends JpaRepository, JpaSp /** * 查询今天的火点信息 * @param addTime + * @param countyCode * @return */ - @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%')",nativeQuery = true) - List selectTodayFirePoint(String addTime); + @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%') and county_code like CONCAT('%',:countyCode,'%')",nativeQuery = true) + List selectTodayFirePoint(String addTime,String countyCode); + + /** + * 区县条件查询今天火点信息 + * @param addTime + * @param countyCode + * @return + */ + @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%') and county_code = :countyCode",nativeQuery = true) + List selectTodayFirePointOne(String addTime,String countyCode); /** * 根据火点编码查询火点信息 diff --git a/src/main/java/com/xkrs/service/FirePointService.java b/src/main/java/com/xkrs/service/FirePointService.java index df00f78..202b905 100644 --- a/src/main/java/com/xkrs/service/FirePointService.java +++ b/src/main/java/com/xkrs/service/FirePointService.java @@ -27,7 +27,7 @@ public interface FirePointService { * @param * @return */ - List selectTodayFirePoint(); + List selectTodayFirePoint(String countyCode); /** * 动态多条件查询火点信息(省) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 7c9d71a..698ce53 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -110,9 +110,14 @@ public class FirePointServiceImpl implements FirePointService { * @return */ @Override - public List selectTodayFirePoint() { + public List selectTodayFirePoint(String countyCode) { String addTime = DateTimeUtil.dateToString(LocalDate.now()); - return firePointDao.selectTodayFirePoint(addTime); + if(countyCode.substring(2).equals("0000")){ + return firePointDao.selectTodayFirePoint(addTime,countyCode.substring(0,2)); + }else if(countyCode.substring(4).equals("00") && !countyCode.substring(2).equals("0000")){ + return firePointDao.selectTodayFirePoint(addTime,countyCode.substring(0,4)); + } + return firePointDao.selectTodayFirePointOne(addTime,countyCode); } /**