更新火点的街道编号数据

This commit is contained in:
liuchengqian 2022-05-09 10:17:57 +08:00
parent 43e2b0e357
commit c719cedab2
2 changed files with 8 additions and 1 deletions

View File

@ -120,6 +120,13 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
@Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1", nativeQuery = true) @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); 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<FirePointEntity> selectAbnormalStreetCode();
@Transactional(rollbackOn = Exception.class) @Transactional(rollbackOn = Exception.class)
@Modifying(clearAutomatically = true) @Modifying(clearAutomatically = true)
@Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true) @Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true)

View File

@ -608,7 +608,7 @@ public class FirePointServiceImpl implements FirePointService {
@Override @Override
public String updateFirePointStreetCode() { public String updateFirePointStreetCode() {
System.out.println("开始格式化街道编号"); System.out.println("开始格式化街道编号");
List<FirePointEntity> firePointEntityList = firePointDao.findAll(); List<FirePointEntity> firePointEntityList = firePointDao.selectAbnormalStreetCode();
long startTimeMillis = System.currentTimeMillis(); long startTimeMillis = System.currentTimeMillis();
int listSize = firePointEntityList.size(); int listSize = firePointEntityList.size();
for (int i = 0; i < listSize; i++) { for (int i = 0; i < listSize; i++) {