fix(shadow): ignore map rows without site id

This commit is contained in:
zgw
2026-08-28 10:41:36 +08:00
parent da9d311ee5
commit f82fabd979
2 changed files with 7 additions and 1 deletions

View File

@@ -199,7 +199,9 @@ public final class SqlServerShadowFactReader {
+ "FROM shadow_ro.v_device_srgv ORDER BY device_id, guid";
static final String MAP_SQL =
"SELECT TOP (?) guid, site_id, x, y, z, value "
+ "FROM shadow_ro.v_wcs_srgv_map ORDER BY site_id, guid";
+ "FROM shadow_ro.v_wcs_srgv_map "
+ "WHERE NULLIF(LTRIM(RTRIM(CONVERT(nvarchar(256), site_id))), N'') "
+ "IS NOT NULL ORDER BY site_id, guid";
private final JdbcTemplate jdbc;
private final Clock clock;

View File

@@ -219,6 +219,10 @@ class SqlServerShadowFactReaderTest {
.contains("create_date_utc"));
assertTrue(SqlServerShadowFactReader.JdbcFactSource.VEHICLE_SQL
.contains("last_time_utc"));
assertTrue(SqlServerShadowFactReader.JdbcFactSource.MAP_SQL
.contains("NULLIF(LTRIM(RTRIM(CONVERT(nvarchar(256), site_id)))"));
assertTrue(SqlServerShadowFactReader.JdbcFactSource.MAP_SQL
.contains("IS NOT NULL"));
String allSql = SqlServerShadowFactReader.JdbcFactSource.CLOCK_SQL
+ SqlServerShadowFactReader.JdbcFactSource.QUEUE_SQL_PREFIX
+ SqlServerShadowFactReader.JdbcFactSource.QUEUE_SQL_SUFFIX