2f252ffd
王彪总
feat(pay): 实现支付宝支...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zteits.urbanops.module.iot.dal.tdengine.IotDevicePropertyMapper">
<select id="getProductPropertySTableFieldList" resultType="com.zteits.urbanops.module.iot.framework.tdengine.core.TDengineTableField">
DESCRIBE product_property_${productId}
</select>
<update id="createProductPropertySTable">
CREATE STABLE product_property_${productId} (
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_id BIGINT
)
</update>
<update id="alterProductPropertySTableAddField">
ALTER STABLE product_property_${productId}
ADD COLUMN ${field.field} ${field.type}
<if test="field.length != null and field.length > 0">
(${field.length})
</if>
</update>
<update id="alterProductPropertySTableModifyField">
ALTER STABLE product_property_${productId}
MODIFY COLUMN ${field.field} ${field.type}
<if test="field.length != null and field.length > 0">
(${field.length})
</if>
</update>
<update id="alterProductPropertySTableDropField">
ALTER STABLE product_property_${productId}
DROP COLUMN ${field.field}
</update>
<insert id="insert">
INSERT INTO device_property_${device.id}
USING product_property_${device.productId}
TAGS ('${device.id}')
(ts, report_time,
<foreach item="key" collection="properties.keys" separator=",">
${@cn.hutool.core.util.StrUtil@toUnderlineCase(key)}
</foreach>
)
VALUES
(NOW, #{reportTime},
<foreach item="value" collection="properties.values" separator=",">
#{value}
</foreach>
)
</insert>
<select id="describeSuperTable" resultType="java.util.Map">
DESCRIBE product_property_${productId}
</select>
<select id="selectListByHistory"
resultType="com.zteits.urbanops.module.iot.controller.admin.device.vo.property.IotDevicePropertyRespVO">
SELECT ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} AS `value`, ts AS update_time
FROM device_property_${reqVO.deviceId}
WHERE ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} IS NOT NULL
AND ts BETWEEN ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[0])}
AND ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[1])}
ORDER BY ts DESC
</select>
</mapper>
|