From c719cedab2e388bd557ebc4f06e145b76d4766e4 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 9 May 2022 10:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=81=AB=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E8=A1=97=E9=81=93=E7=BC=96=E5=8F=B7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/dao/FirePointDao.java | 7 +++++++ .../java/com/xkrs/service/impl/FirePointServiceImpl.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/xkrs/dao/FirePointDao.java b/src/main/java/com/xkrs/dao/FirePointDao.java index 625cb55..3e5e650 100644 --- a/src/main/java/com/xkrs/dao/FirePointDao.java +++ b/src/main/java/com/xkrs/dao/FirePointDao.java @@ -120,6 +120,13 @@ public interface FirePointDao extends JpaRepository, JpaS @Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1", nativeQuery = true) void updateBeforeFireAndAfterFireImage(String fireCode, String beforeFireImage, String afterFireImage); + /** + * 查询街道编码异常的火点 + */ +// @Query(value = "SELECT * FROM fire_point WHERE length(street_code) != 9", nativeQuery = true) + @Query(value = "SELECT * FROM fire_point WHERE street_code ISNULL", nativeQuery = true) + List selectAbnormalStreetCode(); + @Transactional(rollbackOn = Exception.class) @Modifying(clearAutomatically = true) @Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 5f81766..1eff5aa 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -608,7 +608,7 @@ public class FirePointServiceImpl implements FirePointService { @Override public String updateFirePointStreetCode() { System.out.println("开始格式化街道编号"); - List firePointEntityList = firePointDao.findAll(); + List firePointEntityList = firePointDao.selectAbnormalStreetCode(); long startTimeMillis = System.currentTimeMillis(); int listSize = firePointEntityList.size(); for (int i = 0; i < listSize; i++) {