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++) {