From 0e613ea3f381d3a3c349873b02b5e0f9a1857ec2 Mon Sep 17 00:00:00 2001 From: huolibo Date: Sat, 25 Feb 2023 14:48:25 +0800 Subject: [PATCH] enh(driver): add spring + mybatis type:byte[] example (#20050) * enh(driver): add spring + mybatis type:byte[] example * doc: add init description * docs: add byte[] description --- examples/JDBC/springbootdemo/readme.md | 7 +++++ .../springbootdemo/dao/WeatherMapper.xml | 10 +++++-- .../springbootdemo/domain/Weather.java | 30 +++++++++++++++++++ .../service/WeatherService.java | 2 ++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/examples/JDBC/springbootdemo/readme.md b/examples/JDBC/springbootdemo/readme.md index a3942a6a51..a89e21c009 100644 --- a/examples/JDBC/springbootdemo/readme.md +++ b/examples/JDBC/springbootdemo/readme.md @@ -1,6 +1,13 @@ ## TDengine SpringBoot + Mybatis Demo ## 需要提前创建 test 数据库 + +``` +$ taos -s 'create database if not exists test' + +$ curl http://localhost:8080/weather/init +``` + ### 配置 application.properties ```properties # datasource config diff --git a/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml b/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml index 99d5893ec1..4899ec4654 100644 --- a/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml +++ b/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml @@ -7,6 +7,7 @@ + - insert into test.t#{groupId} (ts, temperature, humidity, note) - values (#{ts}, ${temperature}, ${humidity}, #{note}) + insert into test.t#{groupId} (ts, temperature, humidity, note, bytes) + values (#{ts}, ${temperature}, ${humidity}, #{note}, #{bytes})