mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-02 04:08:54 +08:00
feat: sql(template)
This commit is contained in:
parent
d82a80e524
commit
d0ebc9355c
@ -454,40 +454,40 @@ generateFrom(Trigger) ->
|
||||
case Uri of
|
||||
<<"trigger/product/property">> ->
|
||||
case Params of
|
||||
#{<<"productKey">> := ProductId, <<"deviceName">> := Devaddr} ->
|
||||
case Devaddr of
|
||||
#{<<"productKey">> := ProductId, <<"deviceName">> := DeviceId} ->
|
||||
case DeviceId of
|
||||
<<"">> ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/", Devaddr/binary>>;
|
||||
<<"$dg/alarm/", ProductId/binary, "/#">>;
|
||||
<<"#">> ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/">>;
|
||||
<<"$dg/alarm/", ProductId/binary, "/#">>;
|
||||
_ ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/", Devaddr/binary, "/#">>
|
||||
<<"$dg/alarm/", ProductId/binary, "/", DeviceId/binary, "/#">>
|
||||
end;
|
||||
_ ->
|
||||
<<"$dg/alarm/", "test/#">>
|
||||
end;
|
||||
<<"trigger/product/event">> ->
|
||||
case Params of
|
||||
#{<<"productKey">> := ProductId, <<"deviceName">> := Devaddr} ->
|
||||
case Devaddr of
|
||||
#{<<"productKey">> := ProductId, <<"deviceName">> := DeviceId} ->
|
||||
case DeviceId of
|
||||
<<"">> ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/", Devaddr/binary>>;
|
||||
<<"$dg/alarm/", ProductId/binary, "/#">>;
|
||||
<<"#">> ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/">>;
|
||||
<<"$dg/alarm/", ProductId/binary, "/#">>;
|
||||
_ ->
|
||||
<<"$dg/alarm/", ProductId/binary, "/", Devaddr/binary, "/#">>
|
||||
<<"$dg/alarm/", ProductId/binary, "/", DeviceId/binary, "/#">>
|
||||
end;
|
||||
_ ->
|
||||
<<"$dg/alarm/", "test/#">>
|
||||
end;
|
||||
<<"trigger/mqtt/event">> ->
|
||||
case Params of
|
||||
#{<<"productKey">> := ProductId, <<"mqtt">> := Mqtt, <<"deviceName">> := Devaddr} ->
|
||||
#{<<"productKey">> := ProductId, <<"mqtt">> := Mqtt, <<"deviceName">> := DeviceId} ->
|
||||
case ProductId of
|
||||
<<"">> ->
|
||||
<<"$events/", Mqtt/binary, "/", ProductId/binary, "/", Devaddr/binary>>;
|
||||
<<"$events/", Mqtt/binary, "/", ProductId/binary, "/", DeviceId/binary>>;
|
||||
_ ->
|
||||
<<"$events/", Mqtt/binary, "/", ProductId/binary, "/", Devaddr/binary, "/#">>
|
||||
<<"$events/", Mqtt/binary, "/", ProductId/binary, "/", DeviceId/binary, "/#">>
|
||||
end;
|
||||
_ ->
|
||||
<<"$dg/alarm/", "test/#">>
|
||||
|
Loading…
Reference in New Issue
Block a user