TdThinkModelMessageMapper.xml 1 KB
<?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="cn.iocoder.yudao.module.iot.dal.tdengine.TdThingModelMessageMapper">

    <!-- 创建物模型消息日志超级表 -->
    <update id="createSuperTable">
        CREATE STABLE thing_model_message_${productKey}(
            ts TIMESTAMP,
            id NCHAR(64),
            sys NCHAR(2048),
            method NCHAR(255),
            params NCHAR(2048),
            device_name NCHAR(64)
        )TAGS (
            device_key NCHAR(50)
        )
    </update>

    <!-- 创建物模型消息日志子表,带有deviceKey的TAG -->
    <update id="createTableWithTag">
        CREATE STABLE ${deviceKey}
        USING thing_model_message_${productKey}(
            ts,
            id ,
            sys ,
            method ,
            params ,
            device_name
        )TAGS(
            #{device_key}
        )
    </update>
</mapper>