From 1ca1bb06d9231e4855cfcd1337f323a68da5f8d4 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Mon, 11 Dec 2023 11:17:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A3=85=E7=BD=AEId=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MySQLAdo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MySQLAdo.cpp b/src/MySQLAdo.cpp index e131b2a..3d2a7f4 100644 --- a/src/MySQLAdo.cpp +++ b/src/MySQLAdo.cpp @@ -190,7 +190,7 @@ bool PingDatabase() #ifdef USING_MYSQL bool LoadIecPoints() { - const char* sql = "SELECT t1.`id`,t1.sadr,t1.`site_id`,t1.`sensor_id`,t1.item_no,t1.yx_bit,t1.stype,t2.sensor_code,t2.grp_no FROM niec_points AS t1 LEFT JOIN niec_sensors AS t2 ON t1.sensor_id=t2.`id` WHERE t1.`status`=1 AND t2.`status`=1 ORDER BY t1.site_id,t1.sadr,t2.`grp_no`,t1.`item_no`"; + const char* sql = "SELECT t1.`id`,t1.sadr,t1.`site_id`,t1.`sensor_id`,t1.item_no,t1.yx_bit,t1.stype,t2.sensor_code,t2.grp_no,t2.dev_id FROM niec_points AS t1 LEFT JOIN niec_sensors AS t2 ON t1.sensor_id=t2.`id` WHERE t1.`status`=1 AND t2.`status`=1 ORDER BY t1.site_id,t1.sadr,t2.`grp_no`,t1.`item_no`"; if (mysql_query(mysql, sql)) { @@ -214,12 +214,13 @@ bool LoadIecPoints() // t1.`id`,t1.`site_id`,t1.`sensor_id`,t2.sensor_code,t2.grp_no pt.sadr = strtoul(row[fieldIdx++], NULL, 10); pt.siteId = strtoul(row[fieldIdx++], NULL, 10); - pt.sensorId = strtoul(row[fieldIdx++], NULL, 10); + fieldIdx++; // id pt.itemNo = strtoul(row[fieldIdx++], NULL, 10); pt.yxBit = strtoul(row[fieldIdx++], NULL, 10); pt.stype = strtoul(row[fieldIdx++], NULL, 10); fieldIdx++; // sensor code 17位编码 pt.sensorGroupNo = strtoul(row[fieldIdx++], NULL, 10); + pt.sensorId = strtoul(row[fieldIdx++], NULL, 10); if (pt.stype == 1) // YX {