提交 3ec1adf7 编写于 作者: Z zyyang

change

上级 5454f092
......@@ -3,6 +3,7 @@ package com.taosdata.example.mybatisplusdemo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.taosdata.example.mybatisplusdemo.domain.Temperature;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
public interface TemperatureMapper extends BaseMapper<Temperature> {
......@@ -10,8 +11,8 @@ public interface TemperatureMapper extends BaseMapper<Temperature> {
@Update("CREATE TABLE if not exists temperature(ts timestamp, temperature float) tags(location nchar(64), tbIndex int)")
int createSuperTable();
@Update("create table #{tbName} using temperature tags( #{location} )")
int createTable(String tbName, String location);
@Update("create table #{tbName} using temperature tags( #{location}, #{tbIndex})")
int createTable(@Param("tbName") String tbName, @Param("location") String location, @Param("tbIndex") int tbIndex);
@Update("drop table if exists temperature")
void dropSuperTable();
......
......@@ -28,11 +28,12 @@ public class TemperatureMapperTest {
@Before
public void before() {
mapper.dropSuperTable();
// create table temperature
mapper.createSuperTable();
// create table t_X using temperature
for (int i = 0; i < 10; i++) {
mapper.createTable("t_" + i, locations[random.nextInt(locations.length)]);
mapper.createTable("t_" + i, locations[random.nextInt(locations.length)], i);
}
// insert into table
int affectRows = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册