From a1c114ee4fb88249f419ed0b44b0dd0857124351 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Fri, 15 Aug 2025 18:52:57 +0800 Subject: [PATCH] fix mysql endpoint --- apps/iot/src/endpoint/endpoint_mysql.erl | 4 ++-- apps/iot/src/iot_sup.erl | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/iot/src/endpoint/endpoint_mysql.erl b/apps/iot/src/endpoint/endpoint_mysql.erl index 428da5f..9ec12aa 100644 --- a/apps/iot/src/endpoint/endpoint_mysql.erl +++ b/apps/iot/src/endpoint/endpoint_mysql.erl @@ -127,9 +127,9 @@ handle_info({next_data, _Id, _Tuple}, State = #state{status = ?DISCONNECTED}) -> {noreply, State}; %% 发送数据到mqtt服务器 handle_info({next_data, Id, ServiceId, Format, Metric}, State = #state{status = ?CONNECTED, pool_pid = PoolPid, buffer = Buffer, - endpoint = #endpoint{title = Title, config = #mysql_endpoint{table_name = Table}}}) -> + endpoint = #endpoint{title = Title, config = #mysql_endpoint{table_name = Table, fields_map = FieldsMap}}}) -> - {ok, InsertSql, Values} = insert_sql(Table, ServiceId, Format, Metric), + {ok, InsertSql, Values} = insert_sql(Table, ServiceId, Format, FieldsMap, Metric), case poolboy:transaction(PoolPid, fun(ConnPid) -> mysql:query(ConnPid, InsertSql, Values) end) of ok -> NBuffer = endpoint_buffer:ack(Id, Buffer), diff --git a/apps/iot/src/iot_sup.erl b/apps/iot/src/iot_sup.erl index becf8a6..413a134 100644 --- a/apps/iot/src/iot_sup.erl +++ b/apps/iot/src/iot_sup.erl @@ -5,7 +5,6 @@ -module(iot_sup). -behaviour(supervisor). --include_lib("endpoint/include/endpoint.hrl"). -export([start_link/0]).