【功能优化】IoT:设备属性日志表,增加 report_time 上报时间
This commit is contained in:
@@ -9,13 +9,16 @@
|
||||
</select>
|
||||
|
||||
<update id="createProductPropertySTable">
|
||||
CREATE STABLE product_property_${productKey}
|
||||
<foreach item="field" collection="fields" separator="," open="(" close=")">
|
||||
CREATE STABLE product_property_${productKey} (
|
||||
ts TIMESTAMP,
|
||||
report_time TIMESTAMP,
|
||||
<foreach item="field" collection="fields" separator=",">
|
||||
${field.field} ${field.type}
|
||||
<if test="field.length != null and field.length > 0">
|
||||
(${field.length})
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
TAGS (
|
||||
device_key NCHAR(50)
|
||||
)
|
||||
@@ -42,19 +45,20 @@
|
||||
DROP COLUMN ${field.field}
|
||||
</update>
|
||||
|
||||
<insert id="insertDevicePropertyData">
|
||||
INSERT INTO device_property_${deviceKey}
|
||||
USING product_property_${productKey}
|
||||
TAGS ('${deviceKey}')
|
||||
(ts
|
||||
<foreach item="item" collection="columns" separator=",">
|
||||
,${item.fieldName}
|
||||
<!-- TODO 芋艿,report_time 需要增加下 -->
|
||||
<insert id="insert">
|
||||
INSERT INTO device_property_${device.deviceKey}
|
||||
USING product_property_${device.productKey}
|
||||
TAGS ('${device.deviceKey}')
|
||||
(ts, report_time,
|
||||
<foreach item="key" collection="properties.keys" separator=",">
|
||||
${key}
|
||||
</foreach>
|
||||
)
|
||||
VALUES
|
||||
(NOW
|
||||
<foreach item="item" collection="columns" separator=",">
|
||||
,#{item.fieldValue}
|
||||
)
|
||||
VALUES
|
||||
(NOW, #{reportTime},
|
||||
<foreach item="value" collection="properties.values" separator=",">
|
||||
#{value}
|
||||
</foreach>
|
||||
)
|
||||
</insert>
|
||||
|
||||
Reference in New Issue
Block a user