TdEngineTableMapper.xml 1.07 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.TdEngineTableMapper">

    <!-- 创建子表 -->
    <update id="createTable">
        CREATE TABLE IF NOT EXISTS ${dataBaseName}.${tableName}
        USING ${dataBaseName}.${superTableName}
        TAGS
        <foreach item="item" collection="tags" separator=","
                 open="(" close=")">
            #{item.fieldValue}
        </foreach>
    </update>

    <!-- 创建子表,带有 TAGS -->
    <update id="createTableWithTags">
        CREATE TABLE IF NOT EXISTS ${dataBaseName}.${tableName}
        USING ${dataBaseName}.${superTableName}
        <foreach item="item" collection="tags" separator="," open="(" close=")">
            #{item.fieldName}
        </foreach>
        TAGS
        <foreach item="item" collection="tags" separator=","
                 open="(" close=")">
            #{item.fieldValue}
        </foreach>
    </update>

</mapper>