diff --git a/src/main/java/com/iot/modbus_rtcp/jobs/AutoCollectJobs.java b/src/main/java/com/iot/modbus_rtcp/jobs/AutoCollectJobs.java index 7d298f1..c6cb129 100644 --- a/src/main/java/com/iot/modbus_rtcp/jobs/AutoCollectJobs.java +++ b/src/main/java/com/iot/modbus_rtcp/jobs/AutoCollectJobs.java @@ -29,9 +29,9 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class AutoCollectJobs { - private static final String SQL = "SELECT id as commandId, ref_id as deviceId, command, " + - "message_length messageLength, '4B454E454E4731343030303030333538' as identifier FROM commands " + - "WHERE type = 'COLLECTION' and ref_type = 'DEVICE' and id < 10099 order by id"; + private static final String SQL = "SELECT c.id AS commandId,c.ref_id AS deviceId,c.command, " + + "c.message_length messageLength,d.gateway_sn AS identifier FROM commands c JOIN device d " + + "ON c.ref_id = d.id WHERE c.type = 'COLLECTION' AND c.ref_type = 'DEVICE' ORDER BY c.id "; private final JdbcTemplate jdbcTemplate; private final ModbusTCPController controller;