<?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.taosdata.jdbc.springbootdemo.dao.TableMapper">

    <update id="createSTable" parameterType="com.taosdata.jdbc.springbootdemo.domain.TableMetadata">
        create table if not exists ${dbname}.${tablename}
        <foreach collection="fields" item="field" index="index" open="(" close=")" separator=",">
            ${field.name} ${field.type}
        </foreach>
        TAGS
        <foreach collection="tags" item="tag" index="index" open="(" close=")" separator=",">
            ${tag.name} ${tag.type}
        </foreach>
    </update>

    <update id="dropTable" parameterType="java.lang.String">
        drop ${tablename}
    </update>

</mapper>