| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?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.middle.platform.data.biz.mapper.TaosMapper">
- <update id="createProduct">
- CREATE STABLE IF NOT EXISTS product_${code} (ts TIMESTAMP, line NCHAR(32),val NCHAR(32),msg_id
- NCHAR(64),reserve NCHAR(64),origin_time TIMESTAMP) TAGS (guid NCHAR(32))
- </update>
- <update id="createDeviceTable">
- CREATE TABLE IF NOT EXISTS device_${code}_${guid} using product_${code} TAGS (#{guid})
- </update>
- <insert id="insert">
- INSERT INTO device_${code}_${guid} (ts, line, val, msg_id,reserve, origin_time)
- VALUES (#{ts}, #{line}, #{val}, #{msgId}, #{reserve}, #{originTime})
- </insert>
- <insert id="batchInsert">
- INSERT INTO device_${code}_${guid} (ts, line, val, msg_id, reserve, origin_time) VALUES
- <foreach collection='list' item='item' index='index' separator=','>
- (#{item.ts}, #{item.line}, #{item.val}, #{item.msgId}, #{item.reserve}, #{item.originTime})
- </foreach>
- </insert>
- <!--源数据-->
- <select id="createOriginal" >
- create STABLE IF NOT EXISTS original_${code} (ts TIMESTAMP, raw_str varchar(10000),msg_id NCHAR(64)) tags (guid varchar(64));
- </select>
- <select id="createOriginalTable" >
- CREATE TABLE IF NOT EXISTS original_${code}_${guid} using original_${code} TAGS (#{guid})
- </select>
- <insert id="insertOriginal">
- INSERT INTO original_${code}_${guid} (ts, raw_str,msg_id)
- VALUES (#{ts}, #{rawStr}, #{msgId})
- </insert>
- <select id="batchInsertOriginal" resultType="int">
- INSERT INTO original_${code}_${guid} (ts, raw_str,msg_id) VALUES
- <foreach collection='list' item='item' index='index' separator=',' >
- (#{item.ts}, #{item.rawStr}, #{item.msgId})
- </foreach>
- </select>
- </mapper>
|