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]).