提交 9e3d838c 编写于 作者: xiaonannet's avatar xiaonannet

Merge branch 'release/1.0.0' into main

......@@ -114,7 +114,7 @@ smqtt:
url: 127.0.0.1:7771,127.0.0.1:7772 # 启动节点
port: 7771 # 端口
node: node-1 # 集群节点名称 唯一
namespace: mqtts
namespace: thinglinks
external:
host: localhost # 用于映射容器ip 请不要随意设置,如果不需要请移除此选项
port: 7777 # 用于映射容器端口 请不要随意设置,如果不需要请移除此选项
......
......@@ -30,8 +30,8 @@ spring:
# 主库数据源
master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/mqtts?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: mqtts
url: jdbc:mysql://127.0.0.1:3306/thinglinks?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: thinglinks
password: D8K8KzHyTeXFLKez
# 从库数据源
# slave:
......
......@@ -62,13 +62,13 @@ seata:
nacos:
serverAddr: 127.0.0.1:8848
group: SEATA_GROUP
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
registry:
type: nacos
nacos:
application: seata-server
server-addr: 127.0.0.1:8848
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# mybatis配置
mybatis:
......
......@@ -19,12 +19,12 @@ spring:
# 服务注册地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -19,12 +19,12 @@ spring:
# 服务注册地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......@@ -43,7 +43,7 @@ spring:
nacos:
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
dataId: sentinel-mqtts-gateway
groupId: DEFAULT_GROUP
data-type: json
......
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.mqttsnet.thinglinks.common.core.annotation.NoRepeatSubmit;
import com.mqttsnet.thinglinks.common.core.domain.R;
import com.mqttsnet.thinglinks.common.core.utils.StringUtils;
import com.mqttsnet.thinglinks.common.core.utils.poi.ExcelUtil;
import com.mqttsnet.thinglinks.common.core.web.controller.BaseController;
import com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult;
......@@ -119,4 +120,48 @@ public class DeviceController extends BaseController {
@RequestParam(value = "protocolType", required = true) String protocolType) {
return R.ok(deviceService.findOneByClientIdAndUserNameAndPasswordAndDeviceStatusAndProtocolType(clientId, userName, password, deviceStatus, protocolType));
}
/**
*校验clientId是否存在
* @param clientId
* @return
*/
@PreAuthorize(hasPermi = "link:device:remove")
@Log(title = "设备管理", businessType = BusinessType.OTHER)
@GetMapping(value = "/validationfindOneByClientId/{clientId}")
public AjaxResult validationfindOneByClientId(@PathVariable("clientId") String clientId)
{
Device findOneByClientId = deviceService.findOneByClientId(clientId);
if (StringUtils.isNull(findOneByClientId)){
AjaxResult.success("clientId可用");
}
return AjaxResult.error("clientId已存在");
}
/**
*校验设备标识是否存在
* @param deviceIdentification
* @return
*/
@GetMapping(value = "/validationFindOneByDeviceIdentification/{deviceIdentification}")
public AjaxResult validationFindOneByDeviceIdentification(@PathVariable("deviceIdentification") String deviceIdentification)
{
Device findOneByDeviceIdentification = deviceService.findOneByDeviceIdentification(deviceIdentification);
if (StringUtils.isNull(findOneByDeviceIdentification)){
AjaxResult.success("设备标识可用");
}
return AjaxResult.error("设备标识已存在");
}
/**
* 设备断开连接接口
*//*
@PreAuthorize(hasPermi = "link:device:remove")
@Log(title = "设备管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceService.deleteDeviceByIds(ids));
}*/
}
package com.mqttsnet.thinglinks.link.controller.product;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.mqttsnet.thinglinks.common.core.annotation.NoRepeatSubmit;
import com.mqttsnet.thinglinks.common.core.constant.Constants;
import com.mqttsnet.thinglinks.common.core.constant.HttpStatus;
import com.mqttsnet.thinglinks.common.core.utils.StringUtils;
import com.mqttsnet.thinglinks.common.core.utils.poi.ExcelUtil;
import com.mqttsnet.thinglinks.common.core.web.controller.BaseController;
import com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult;
......@@ -12,7 +9,6 @@ import com.mqttsnet.thinglinks.common.core.web.page.TableDataInfo;
import com.mqttsnet.thinglinks.common.log.annotation.Log;
import com.mqttsnet.thinglinks.common.log.enums.BusinessType;
import com.mqttsnet.thinglinks.common.security.annotation.PreAuthorize;
import com.mqttsnet.thinglinks.link.api.domain.device.entity.Device;
import com.mqttsnet.thinglinks.link.api.domain.product.entity.Product;
import com.mqttsnet.thinglinks.link.service.product.ProductService;
import lombok.extern.slf4j.Slf4j;
......@@ -158,4 +154,20 @@ public class ProductController extends BaseController {
{
return toAjax(productService.deleteProductByIds(ids));
}
/**
*校验产品名称是否存在
* @param productName
* @return
*/
@GetMapping(value = "/validationFindOneByProductName/{productName}")
public AjaxResult validationFindOneByProductName(@PathVariable("productName") String productName)
{
Product oneByProductName = productService.findOneByProductName(productName);
if (StringUtils.isNull(oneByProductName)){
AjaxResult.success("产品名称可用");
}
return AjaxResult.error("产品名称已存在");
}
}
......@@ -143,4 +143,20 @@ public interface DeviceMapper {
* @return 结果
*/
public int deleteDeviceByIds(Long[] ids);
Device findOneByClientId(@Param("clientId")String clientId);
Device findOneByClientIdAndDeviceIdentification(@Param("clientId")String clientId,@Param("deviceIdentification")String deviceIdentification);
Device findOneByDeviceIdentification(@Param("deviceIdentification")String deviceIdentification);
Device findOneByClientIdOrderByDeviceIdentification(@Param("clientId")String clientId);
Device findOneByClientIdOrDeviceIdentification(@Param("clientId")String clientId,@Param("deviceIdentification")String deviceIdentification);
}
\ No newline at end of file
......@@ -120,4 +120,8 @@ public interface ProductMapper {
*/
public int deleteProductByIds(Long[] ids);
Product findOneByProductName(@Param("productName")String productName);
}
\ No newline at end of file
......@@ -97,5 +97,30 @@ public interface DeviceService {
*/
public int deleteDeviceById(Long id);
Device findOneByClientId(String clientId);
Device findOneByClientIdAndDeviceIdentification(String clientId,String deviceIdentification);
Device findOneByDeviceIdentification(String deviceIdentification);
Device findOneByClientIdOrderByDeviceIdentification(String clientId);
Device findOneByClientIdOrDeviceIdentification(String clientId,String deviceIdentification);
}
package com.mqttsnet.thinglinks.link.service.device.impl;
import com.mqttsnet.thinglinks.common.core.utils.DateUtils;
import com.mqttsnet.thinglinks.common.core.utils.StringUtils;
import com.mqttsnet.thinglinks.common.security.service.TokenService;
import com.mqttsnet.thinglinks.link.api.domain.device.entity.Device;
import com.mqttsnet.thinglinks.link.mapper.device.DeviceMapper;
import com.mqttsnet.thinglinks.link.service.device.DeviceService;
import com.mqttsnet.thinglinks.system.api.domain.SysUser;
import com.mqttsnet.thinglinks.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -25,6 +30,8 @@ public class DeviceServiceImpl implements DeviceService {
@Resource
private DeviceMapper deviceMapper;
@Autowired
private TokenService tokenService;
@Override
public int deleteByPrimaryKey(Long id) {
......@@ -33,21 +40,47 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public int insert(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
return deviceMapper.insert(record);
}
@Override
public int insertOrUpdate(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
if (StringUtils.isEmpty(String.valueOf(record.getId()))){
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
}else {
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
}
return deviceMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
if (StringUtils.isEmpty(String.valueOf(record.getId()))){
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
}else {
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
}
return deviceMapper.insertOrUpdateSelective(record);
}
@Override
public int insertSelective(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
return deviceMapper.insertSelective(record);
}
......@@ -58,11 +91,19 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public int updateByPrimaryKeySelective(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
return deviceMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Device record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
return deviceMapper.updateByPrimaryKey(record);
}
......@@ -135,6 +176,13 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public int insertDevice(Device device)
{
Device oneByClientIdAndDeviceIdentification = deviceMapper.findOneByClientIdOrDeviceIdentification(device.getClientId(), device.getDeviceIdentification());
if(StringUtils.isNull(oneByClientIdAndDeviceIdentification)){
return 0;
}
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
device.setCreateBy(sysUser.getUserName());
device.setCreateTime(DateUtils.getNowDate());
return deviceMapper.insertDevice(device);
}
......@@ -148,7 +196,10 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public int updateDevice(Device device)
{
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
device.setUpdateTime(DateUtils.getNowDate());
device.setUpdateBy(sysUser.getUserName());
return deviceMapper.updateDevice(device);
}
......@@ -176,5 +227,30 @@ public class DeviceServiceImpl implements DeviceService {
return deviceMapper.deleteDeviceById(id);
}
@Override
public Device findOneByClientId(String clientId){
return deviceMapper.findOneByClientId(clientId);
}
@Override
public Device findOneByClientIdAndDeviceIdentification(String clientId,String deviceIdentification){
return deviceMapper.findOneByClientIdAndDeviceIdentification(clientId,deviceIdentification);
}
@Override
public Device findOneByDeviceIdentification(String deviceIdentification){
return deviceMapper.findOneByDeviceIdentification(deviceIdentification);
}
@Override
public Device findOneByClientIdOrderByDeviceIdentification(String clientId){
return deviceMapper.findOneByClientIdOrderByDeviceIdentification(clientId);
}
@Override
public Device findOneByClientIdOrDeviceIdentification(String clientId,String deviceIdentification){
return deviceMapper.findOneByClientIdOrDeviceIdentification(clientId,deviceIdentification);
}
}
package com.mqttsnet.thinglinks.link.service.product;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult;
import com.mqttsnet.thinglinks.link.api.domain.device.entity.Device;
import com.mqttsnet.thinglinks.link.api.domain.product.entity.Product;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @Description: java类作用描述
......@@ -104,4 +101,9 @@ public interface ProductService{
* @return 结果
*/
public int deleteProductById(Long id);
Product findOneByProductName(String productName);
}
......@@ -4,14 +4,22 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.jayway.jsonpath.JsonPath;
import com.mqttsnet.thinglinks.common.core.text.CharsetKit;
import com.mqttsnet.thinglinks.common.core.text.UUID;
import com.mqttsnet.thinglinks.common.core.utils.DateUtils;
import com.mqttsnet.thinglinks.common.core.utils.StringUtils;
import com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult;
import com.mqttsnet.thinglinks.common.security.service.TokenService;
import com.mqttsnet.thinglinks.link.api.domain.product.entity.Product;
import com.mqttsnet.thinglinks.link.mapper.product.ProductMapper;
import com.mqttsnet.thinglinks.link.service.product.ProductService;
import com.mqttsnet.thinglinks.system.api.domain.SysUser;
import com.mqttsnet.thinglinks.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.IOException;
......@@ -19,17 +27,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.mqttsnet.thinglinks.link.mapper.product.ProductMapper;
import com.mqttsnet.thinglinks.link.api.domain.product.entity.Product;
import com.mqttsnet.thinglinks.link.service.product.ProductService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
/**
* @Description: 产品模型业务层
......@@ -70,8 +71,13 @@ public class ProductServiceImpl implements ProductService{
public int insertOrUpdate(Product record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isEmpty(String.valueOf(record.getId()))){
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
}else {
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
}
return productMapper.insertOrUpdate(record);
}
......@@ -79,8 +85,13 @@ public class ProductServiceImpl implements ProductService{
public int insertOrUpdateSelective(Product record) {
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isEmpty(String.valueOf(record.getId()))){
record.setCreateBy(sysUser.getUserName());
record.setCreateTime(DateUtils.getNowDate());
}else {
record.setUpdateTime(DateUtils.getNowDate());
record.setUpdateBy(sysUser.getUserName());
}
return productMapper.insertOrUpdateSelective(record);
}
......@@ -342,6 +353,11 @@ public class ProductServiceImpl implements ProductService{
@Override
public int insertProduct(Product product)
{
Product oneByProductName = productMapper.findOneByProductName(product.getProductName());
if(StringUtils.isNull(oneByProductName)){
return 0;
}
product.setProductIdentification(UUID.getUUID());
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
product.setCreateBy(sysUser.getUserName());
......@@ -388,4 +404,10 @@ public class ProductServiceImpl implements ProductService{
{
return productMapper.deleteProductById(id);
}
@Override
public Product findOneByProductName(String productName){
return productMapper.findOneByProductName(productName);
}
}
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -1227,4 +1227,71 @@
#{id}
</foreach>
</delete>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select id="findOneByClientId" resultMap="DeviceResult">
select
<include refid="Base_Column_List"/>
from device
<where>
<if test="clientId != null">
and client_id=#{clientId}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select id="findOneByClientIdAndDeviceIdentification" resultMap="DeviceResult">
select
<include refid="Base_Column_List"/>
from device
<where>
<if test="clientId != null">
and client_id=#{clientId}
</if>
<if test="deviceIdentification != null">
and device_identification=#{deviceIdentification}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select id="findOneByDeviceIdentification" resultMap="DeviceResult">
select
<include refid="Base_Column_List"/>
from device
<where>
<if test="deviceIdentification != null">
and device_identification=#{deviceIdentification}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select id="findOneByClientIdOrderByDeviceIdentification" resultMap="DeviceResult">
select
<include refid="Base_Column_List"/>
from device
<where>
<if test="clientId != null">
and client_id=#{clientId}
</if>
</where>
order by device_identification asc
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select id="findOneByClientIdOrDeviceIdentification" resultMap="DeviceResult">
select
<include refid="Base_Column_List"/>
from device
<where>
<if test="clientId != null">
and client_id=#{clientId}
</if>
<if test="deviceIdentification != null">
or device_identification=#{deviceIdentification}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -829,4 +829,16 @@
#{id}
</foreach>
</delete>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-17-->
<select id="findOneByProductName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from product
<where>
<if test="productName != null">
and product_name=#{productName,jdbcType=VARCHAR}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -82,7 +82,7 @@
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.35</version>
<version>2.0.37</version>
</dependency>
<!-- thinglinks Common Datasource -->
......
......@@ -84,10 +84,10 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug
<include refid="Base_Column_List" />
from thinglinks.weather
order by ts desc
<if thinglinks="limit != null">
<if test="limit != null">
limit #{limit,jdbcType=BIGINT}
</if>
<if thinglinks="offset != null">
<if test="offset != null">
offset #{offset,jdbcType=BIGINT}
</if>
</select>
......
......@@ -3,7 +3,7 @@
<mapper namespace="com.mqttsnet.thinglinks.tdengine.mapper.WeatherMapper">
<resultMap id="BaseResultMap" type="com.mqttsnet.thinglinks.tdengine.api.domain.model.Weather">
<resultMap id="BaseResultMap" type="com.mqttsnet.thinglinks.tdengine.api.domain.Weather">
<id column="ts" jdbcType="TIMESTAMP" property="ts"/>
<result column="temperature" jdbcType="FLOAT" property="temperature"/>
<result column="humidity" jdbcType="FLOAT" property="humidity"/>
......@@ -45,7 +45,7 @@
), groupId int)
</update>
<update id="createTable" parameterType="com.mqttsnet.thinglinks.tdengine.api.domain.model.Weather">
<update id="createTable" parameterType="com.mqttsnet.thinglinks.tdengine.api.domain.Weather">
create table if not exists thinglinks.t#{groupId} using thinglinks.weather tags
(
#{location},
......@@ -55,15 +55,15 @@
<select id="select" resultMap="BaseResultMap">
select * from thinglinks.weather order by ts desc
<if thinglinks="limit != null">
<if test="limit != null">
limit #{limit,jdbcType=BIGINT}
</if>
<if thinglinks="offset != null">
<if test="offset != null">
offset #{offset,jdbcType=BIGINT}
</if>
</select>
<insert id="insert" parameterType="com.mqttsnet.thinglinks.tdengine.api.domain.model.Weather">
<insert id="insert" parameterType="com.mqttsnet.thinglinks.tdengine.api.domain.Weather">
insert into thinglinks.t#{groupId} (ts, temperature, humidity, note)
values (#{ts}, ${temperature}, ${humidity}, #{note})
</insert>
......@@ -78,7 +78,7 @@
from thinglinks.weather
</select>
<resultMap id="avgResultSet" type="com.mqttsnet.thinglinks.tdengine.api.domain.model.Weather">
<resultMap id="avgResultSet" type="com.mqttsnet.thinglinks.tdengine.api.domain.Weather">
<id column="ts" jdbcType="TIMESTAMP" property="ts"/>
<result column="avg(temperature)" jdbcType="FLOAT" property="temperature"/>
<result column="avg(humidity)" jdbcType="FLOAT" property="humidity"/>
......
......@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 共享配置
......
......@@ -33,5 +33,5 @@ spring:
#自定义配置参数
base:
#本机ip,不要用localhost或127.0.0.1
bindIp: 192.168.10.29
\ No newline at end of file
#本机内网ip,不要用localhost或127.0.0.1
bindIp: 127.0.0.1
\ No newline at end of file
......@@ -19,14 +19,19 @@ spring:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config:
# 配置中心地址
server-addr: 49.235.122.136:8848
#命名空间
namespace: fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace: 1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension: yml
# 关联配置
extension-configs[0]:
data-id: thinglinks-collection-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
group: DEFAULT_GROUP
refresh: true
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册