!33 将TDEngine相关配置移到同一个包中

Merge pull request !33 from xxmfl/master
This commit is contained in:
随遇而安
2022-05-24 02:25:27 +00:00
committed by Gitee
17 changed files with 155 additions and 204 deletions

View File

@@ -43,7 +43,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:
@@ -65,7 +65,7 @@ spring:
# 数据库索引
database: 0
# 密码
password: wumei-smart
password:
# 连接超时时间
timeout: 10s
lettuce:
@@ -82,10 +82,11 @@ spring:
mqtt:
username: wumei-smart # 账号
password: wumei-smart # 密码
host-url: tcp://localhost:1883 # mqtt连接tcp地址
client-id: ${random.int} # 客户端Id不能相同采用随机数 ${random.value}
host-url: tcp://wumei.live:1883 # mqtt连接tcp地址
# host-url: tcp://127.0.0.1:1883
client-id: ${random.value} # 客户端Id每个启动的id要不同 随机:${random.value}
default-topic: test # 默认主题
timeout: 30000 # 超时时间
timeout: 100 # 超时时间
keepalive: 30 # 保持连接
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
task:

View File

@@ -1,34 +1,21 @@
package com.ruoyi.framework.config;
import java.io.IOException;
import java.util.*;
import javax.servlet.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import javax.sql.DataSource;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.util.Utils;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.config.properties.DruidProperties;
import com.ruoyi.framework.datasource.DynamicDataSource;
import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
@@ -47,8 +34,8 @@ import com.ruoyi.common.utils.StringUtils;
* @author ruoyi
*/
@Configuration
@MapperScan(basePackages = {"com.ruoyi.iot.mapper", "com.ruoyi.system.mapper", "com.ruoyi.quartz.mapper", "com.ruoyi.generator.mapper"}, sqlSessionTemplateRef = "mysqlSqlSessionTemplate")
public class MyBatisConfig {
public class MyBatisConfig
{
@Autowired
private Environment env;
@@ -132,11 +119,10 @@ public class MyBatisConfig {
@Bean(name = "mysqlSessionFactory")
@Primary
public SqlSessionFactory sqlSessionFactory(@Qualifier("dynamicDataSource") DataSource dataSource) throws Exception
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
{
String typeAliasesPackage = "com.ruoyi.**.domain";//env.getProperty("mybatis.typeAliasesPackage");
String mapperLocations = "classpath:mapper/iot/*Mapper.xml,classpath:mapper/system/*Mapper.xml,classpath:mapper/quartz/*Mapper.xml";
// String typeAliasesPackage = "com.ruoyi.**.domain";
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
String mapperLocations = env.getProperty("mybatis.mapperLocations");
String configLocation = env.getProperty("mybatis.configLocation");
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class);
@@ -157,8 +143,7 @@ public class MyBatisConfig {
@Bean(name = "mysqlSqlSessionTemplate")
@Primary
public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}

View File

@@ -1,76 +0,0 @@
package com.ruoyi.iot.init;
//import com.ruoyi.mysql.config.TDengineConfig;
//import com.ruoyi.iot.tdengine.config.TDengineConfig;
import com.alibaba.druid.pool.DruidDataSource;
import com.ruoyi.iot.tdengine.config.TDengineConfig;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.mapper.DeviceMapper;
import com.ruoyi.iot.tdengine.mapper.TDDeviceLogMapper;
import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.util.Date;
/**
* 类名: ApplicationStarted
* 描述: TODO
* 时间: 2022/5/18,0018 1:41
* 开发人: wxy
*/
@Component
public class ApplicationStarted implements ApplicationRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationStarted.class);
@Autowired
private TDengineConfig dengineConfig;
@Autowired
private TDDeviceLogMapper deviceLogMapper;
@Autowired
private DeviceMapper deviceMapper;
@Override
public void run(ApplicationArguments args) {
deviceMapper.selectDeviceByDeviceId(0L);
System.out.println("初始化MySql链接成功");
initTDengine();
System.out.println("初始化TDengine链接成功");
}
/**
* @Method
* @Description 开始初始化加载系统参数,创建数据库和超级表
* @Param null
* @return
* @date 2022/5/22,0022 14:27
* @author wxy
*
*/
public void initTDengine() {
try {
String dbName = dengineConfig.getDbName();
int db = deviceLogMapper.createDB(dbName);
deviceLogMapper.createSTable(dbName);
System.out.println(db);
} catch (Exception e) {
e.printStackTrace();
System.out.println("ERROR");
}
}
}

View File

@@ -4,6 +4,7 @@ import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.model.MonitorModel;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
@@ -78,4 +79,7 @@ public interface DeviceLogMapper
* @return 结果
*/
public int deleteDeviceLogByDeviceIds(Long[] deviceIds);
// List<DeviceLog> selectLogList(Long deviceId,String serialNumber,Long isMonitor,Long logType, Date beginDate, Date endDate);
}

View File

@@ -3,7 +3,6 @@ package com.ruoyi.iot.mqtt;
import com.alibaba.fastjson.JSON;
import com.ruoyi.iot.domain.Device;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.model.NtpModel;
import com.ruoyi.iot.model.ThingsModels.IdentityAndName;
import com.ruoyi.iot.model.ThingsModels.ThingsModelValueItem;
@@ -11,6 +10,7 @@ import com.ruoyi.iot.model.ThingsModels.ThingsModelValueRemarkItem;
import com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput;
import com.ruoyi.iot.service.IDeviceLogService;
import com.ruoyi.iot.service.IDeviceService;
import com.ruoyi.iot.tdengine.service.ILogService;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;

View File

@@ -2,6 +2,7 @@ package com.ruoyi.iot.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.tdengine.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.model.MonitorModel;
import com.ruoyi.iot.service.IDeviceLogService;
@@ -22,6 +23,9 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Autowired
private DeviceLogMapper deviceLogMapper;
@Autowired
private ILogService logService;
/**
* 查询设备日志
*
@@ -43,7 +47,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Override
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog)
{
return deviceLogMapper.selectDeviceLogList(deviceLog);
// deviceLogMapper.selectDeviceLogList(deviceLog);
return logService.selectDeviceLogList(deviceLog);
}
/**
@@ -55,7 +60,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Override
public List<MonitorModel> selectMonitorList(DeviceLog deviceLog)
{
return deviceLogMapper.selectMonitorList(deviceLog);
// return deviceLogMapper.selectMonitorList(deviceLog);
return logService.selectMonitorList(deviceLog);
}
/**
@@ -68,7 +74,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
public int insertDeviceLog(DeviceLog deviceLog)
{
deviceLog.setCreateTime(DateUtils.getNowDate());
return deviceLogMapper.insertDeviceLog(deviceLog);
// return deviceLogMapper.insertDeviceLog(deviceLog);
return logService.saveDeviceLog(deviceLog);
}
/**

View File

@@ -11,13 +11,13 @@ import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.iot.domain.Device;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.domain.Product;
import com.ruoyi.iot.tdengine.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.mapper.DeviceMapper;
import com.ruoyi.iot.mapper.DeviceUserMapper;
import com.ruoyi.iot.model.*;
import com.ruoyi.iot.model.ThingsModelItem.*;
import com.ruoyi.iot.model.ThingsModels.*;
import com.ruoyi.iot.service.IDeviceLogService;
import com.ruoyi.iot.service.IDeviceService;
import com.ruoyi.iot.service.IProductService;
import com.ruoyi.iot.service.IToolService;
@@ -73,8 +73,11 @@ public class DeviceServiceImpl implements IDeviceService {
@Autowired
private ISysUserService userService;
// @Autowired
// private IDeviceLogService deviceLogService;
@Autowired
private IDeviceLogService deviceLogService;
private ILogService logService;
/**
* 查询设备
@@ -196,7 +199,8 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setCreateTime(DateUtils.getNowDate());
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
deviceLog.setLogType(type);
deviceLogMapper.insertDeviceLog(deviceLog);
logService.saveDeviceLog(deviceLog);
// deviceLogMapper.insertDeviceLog(deviceLog);
break;
}
}
@@ -588,7 +592,8 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setIdentity("offline");
deviceLog.setLogType(6);
}
deviceLogService.insertDeviceLog(deviceLog);
logService.saveDeviceLog(deviceLog);
// deviceLogService.insertDeviceLog(deviceLog);
return result;
}

View File

@@ -2,7 +2,6 @@ package com.ruoyi.iot.tdengine.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.iot.tdengine.mapper.TDDeviceLogMapper;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
@@ -31,13 +30,10 @@ import java.util.List;
* 开发人: wxy
*/
@Configuration
@MapperScan(basePackages = {"com.ruoyi.iot.tdengine.mapper"}, sqlSessionTemplateRef = "tdengineSqlSessionTemplate")
@MapperScan(basePackages = {"com.ruoyi.iot.tdengine.dao"}, sqlSessionTemplateRef = "tdengineSqlSessionTemplate")
@ConditionalOnProperty(name = "spring.datasource.druid.tdengine-server.enabled", havingValue = "true")
public class TDengineConfig {
@Autowired
private TDDeviceLogMapper deviceLogMapper;
@Value("${spring.datasource.druid.tdengine-server.dbName}")
private String dbName;
@@ -64,22 +60,6 @@ public class TDengineConfig {
return new SqlSessionTemplate(sqlSessionFactory);
}
// @Bean
// @ConditionalOnProperty(name = "spring.datasource.druid.tdengine-server.enabled", havingValue = "true")
// public TDDeviceLogMapper genTdengineLogMapper(@Qualifier("tDengineDataSource") TDDeviceLogMapper mapper) {
// if(this.deviceLogMapper==null){
// this.deviceLogMapper=mapper;
// }
// return this.deviceLogMapper;
// }
public TDDeviceLogMapper getTDengineLogMapper() {
return deviceLogMapper;
}
public String getDbName() {
return dbName;
}

View File

@@ -1,4 +1,4 @@
package com.ruoyi.iot.tdengine.mapper;
package com.ruoyi.iot.tdengine.dao;
import org.springframework.stereotype.Repository;
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository;
* 开发人: wxy
*/
@Repository
public interface DatabaseMapper {
public interface DatabaseDAO {
int createDB();

View File

@@ -1,11 +1,10 @@
package com.ruoyi.iot.tdengine.mapper;
package com.ruoyi.iot.tdengine.dao;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.model.MonitorModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.lang.management.MonitorInfo;
import java.util.Date;
import java.util.List;
@@ -17,7 +16,7 @@ import java.util.List;
* 开发人: wxy
*/
@Repository
public interface TDDeviceLogMapper {
public interface TDDeviceLogDAO {
int createDB( String database);

View File

@@ -0,0 +1,79 @@
package com.ruoyi.iot.tdengine.init;
import com.ruoyi.iot.tdengine.config.TDengineConfig;
import com.ruoyi.iot.tdengine.dao.TDDeviceLogDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
/**
* 类名: ApplicationStarted
* 描述: TODO
* 时间: 2022/5/18,0018 1:41
* 开发人: wxy
*/
@Component
public class ApplicationStarted implements ApplicationRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationStarted.class);
@Autowired
private ApplicationContext applicationContext;
@Override
public void run(ApplicationArguments args) {
//先获取TDengine的配置检测TDengine是否已经配置
if (containBean(TDengineConfig.class)) {
TDengineConfig tDengineConfig = applicationContext.getBean(TDengineConfig.class);
TDDeviceLogDAO tDDeviceLogDAO = applicationContext.getBean(TDDeviceLogDAO.class);
initTDengine(tDengineConfig, tDDeviceLogDAO);
System.out.println("初始化TDengine成功");
}else{
System.out.println("MySQL初始化成功");
}
}
/**
* @return
* @Method
* @Description 开始初始化加载系统参数, 创建数据库和超级表
* @Param null
* @date 2022/5/22,0022 14:27
* @author wxy
*/
public void initTDengine(TDengineConfig dengineConfig, TDDeviceLogDAO deviceLogMapper) {
try {
String dbName = dengineConfig.getDbName();
int db = deviceLogMapper.createDB(dbName);
deviceLogMapper.createSTable(dbName);
System.out.println(db);
} catch (Exception e) {
e.printStackTrace();
System.out.println("ERROR");
}
}
/**
* @return
* @Method containBean
* @Description 根据类判断是否有对应bean
* @Param 类
* @date 2022/5/22,0022 14:12
* @author wxy
*/
private boolean containBean(@Nullable Class<?> T) {
String[] beans = applicationContext.getBeanNamesForType(T);
if (beans == null || beans.length == 0) {
return false;
} else {
return true;
}
}
}

View File

@@ -1,4 +1,4 @@
package com.ruoyi.iot.log.service;
package com.ruoyi.iot.tdengine.service;
import com.ruoyi.iot.domain.DeviceLog;

View File

@@ -1,28 +1,17 @@
package com.ruoyi.iot.log.service.factory;
package com.ruoyi.iot.tdengine.service.factory;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.framework.config.MyBatisConfig;
import com.ruoyi.iot.log.service.impl.MySqlLogServiceImpl;
import com.ruoyi.iot.log.service.impl.TdengineLogServiceImpl;
import com.ruoyi.iot.model.MonitorModel;
import com.ruoyi.iot.tdengine.service.impl.MySqlLogServiceImpl;
import com.ruoyi.iot.tdengine.service.impl.TdengineLogServiceImpl;
import com.ruoyi.iot.tdengine.config.TDengineConfig;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.tdengine.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.tdengine.mapper.TDDeviceLogMapper;
import com.ruoyi.iot.util.SnowflakeIdWorker;
import com.ruoyi.iot.tdengine.dao.TDDeviceLogDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 类名: DeviceLogServiceImpl
@@ -41,8 +30,8 @@ public class LogServiceFactory {
//先获取TDengine的配置检测TDengine是否已经配置
if (containBean(TDengineConfig.class)) {
TDengineConfig tDengineConfig = applicationContext.getBean(TDengineConfig.class);
TDDeviceLogMapper tDDeviceLogMapper = applicationContext.getBean(TDDeviceLogMapper.class);
ILogService logService = new TdengineLogServiceImpl(tDengineConfig, tDDeviceLogMapper);
TDDeviceLogDAO tDDeviceLogDAO = applicationContext.getBean(TDDeviceLogDAO.class);
ILogService logService = new TdengineLogServiceImpl(tDengineConfig, tDDeviceLogDAO);
return logService;
} else if (containBean(MyBatisConfig.class)) {
//没有配置TDengine那么使用MySQL的日志配置

View File

@@ -1,10 +1,9 @@
package com.ruoyi.iot.log.service.impl;
package com.ruoyi.iot.tdengine.service.impl;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.tdengine.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.model.MonitorModel;
import org.springframework.stereotype.Service;
import java.util.List;

View File

@@ -1,15 +1,12 @@
package com.ruoyi.iot.log.service.impl;
package com.ruoyi.iot.tdengine.service.impl;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.tdengine.service.ILogService;
import com.ruoyi.iot.model.MonitorModel;
import com.ruoyi.iot.tdengine.config.TDengineConfig;
import com.ruoyi.iot.tdengine.mapper.TDDeviceLogMapper;
import com.ruoyi.iot.tdengine.dao.TDDeviceLogDAO;
import com.ruoyi.iot.util.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -23,7 +20,7 @@ public class TdengineLogServiceImpl implements ILogService {
private ApplicationContext applicationContext;
private TDDeviceLogMapper tdDeviceLogMapper;
private TDDeviceLogDAO tdDeviceLogDAO;
private TDengineConfig tDengineConfig;
@@ -31,8 +28,8 @@ public class TdengineLogServiceImpl implements ILogService {
private String dbName;
public TdengineLogServiceImpl(TDengineConfig _tDengineConfig,TDDeviceLogMapper _tdDeviceLogMapper) {
this.tdDeviceLogMapper = _tdDeviceLogMapper;
public TdengineLogServiceImpl(TDengineConfig _tDengineConfig, TDDeviceLogDAO _tdDeviceLogDAO) {
this.tdDeviceLogDAO = _tdDeviceLogDAO;
this.tDengineConfig = _tDengineConfig;
snowflakeIdWorker=new SnowflakeIdWorker(1);
this.dbName=_tDengineConfig.getDbName();
@@ -42,16 +39,16 @@ public class TdengineLogServiceImpl implements ILogService {
public int saveDeviceLog(DeviceLog deviceLog) {
long logId = snowflakeIdWorker.nextId();
deviceLog.setLogId(logId);
return tdDeviceLogMapper.save(dbName,deviceLog);
return tdDeviceLogDAO.save(dbName,deviceLog);
}
@Override
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog) {
return tdDeviceLogMapper.selectDeviceLogList(dbName,deviceLog);
return tdDeviceLogDAO.selectDeviceLogList(dbName,deviceLog);
}
@Override
public List<MonitorModel> selectMonitorList(DeviceLog deviceLog) {
return tdDeviceLogMapper.selectMonitorList(dbName,deviceLog);
return tdDeviceLogDAO.selectMonitorList(dbName,deviceLog);
}
}

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.iot.tdengine.mapper.DatabaseMapper">
<mapper namespace="com.ruoyi.iot.tdengine.dao.DatabaseDAO">
<!-- 创建数据库-->
<update id="createDB" parameterType="java.lang.String">
@@ -19,24 +19,6 @@
use ${dbName};
</update>
<update id="createsTable">
create stable if not exists ${tableName}
(ts timestamp,
log_id BIGINT,
identity NCHAR(100),
log_type NCHAR(20),
log_value NCHAR(100),
device_id BIGINT,
device_name NCHAR(100),
serial_number NCHAR(100),
is_monitor int,
create_by NCHAR(100),
create_time timestamp,
remark NCHAR(1000),
);
</update>
<update id="createTable">
create stable if not exists ${tableName}
(ts timestamp,

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.iot.tdengine.mapper.TDDeviceLogMapper">
<mapper namespace="com.ruoyi.iot.tdengine.dao.TDDeviceLogDAO">
<resultMap id="BaseResultMap" type="com.ruoyi.iot.domain.DeviceLog">
<id column="ts" property="ts"/>