add count and select tbname SQL test in springbootdemo
This commit is contained in:
parent
ecf5daae66
commit
b82a1c71be
|
@ -59,4 +59,14 @@ public class WeatherController {
|
||||||
return weatherService.save(weatherList);
|
return weatherService.save(weatherList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/count")
|
||||||
|
public int count() {
|
||||||
|
return weatherService.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/subTables")
|
||||||
|
public List<String> getSubTables() {
|
||||||
|
return weatherService.getSubTables();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,8 @@ public interface WeatherMapper {
|
||||||
void createDB();
|
void createDB();
|
||||||
|
|
||||||
void createTable();
|
void createTable();
|
||||||
|
|
||||||
|
int count();
|
||||||
|
|
||||||
|
List<String> getSubTables();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,12 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="getSubTables">
|
||||||
|
select tbname from test.weather
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="count">
|
||||||
|
select count(*) from test.weather;
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -35,4 +35,12 @@ public class WeatherService {
|
||||||
return weatherMapper.batchInsert(weatherList);
|
return weatherMapper.batchInsert(weatherList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int count() {
|
||||||
|
return weatherMapper.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getSubTables() {
|
||||||
|
return weatherMapper.getSubTables();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
# datasource config - JDBC-JNI
|
# datasource config - JDBC-JNI
|
||||||
spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver
|
#spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver
|
||||||
spring.datasource.url=jdbc:TAOS://127.0.0.1:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
|
#spring.datasource.url=jdbc:TAOS://127.0.0.1:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
|
||||||
|
#spring.datasource.username=root
|
||||||
|
#spring.datasource.password=taosdata
|
||||||
|
|
||||||
|
# datasource config - JDBC-RESTful
|
||||||
|
spring.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
|
||||||
|
spring.datasource.url=jdbc:TAOS-RS://master:6041/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=taosdata
|
spring.datasource.password=taosdata
|
||||||
|
|
||||||
# datasource config - JDBC-RESTful
|
|
||||||
#spring.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
|
|
||||||
#spring.datasource.url=jdbc:TAOS-RS://master:6041/test?user=root&password=taosdata
|
|
||||||
|
|
||||||
spring.datasource.druid.initial-size=5
|
spring.datasource.druid.initial-size=5
|
||||||
spring.datasource.druid.min-idle=5
|
spring.datasource.druid.min-idle=5
|
||||||
|
|
Loading…
Reference in New Issue