diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/DeviceController.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/DeviceController.java index 469ba01..f2d3e71 100644 --- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/DeviceController.java +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/DeviceController.java @@ -87,7 +87,7 @@ public class DeviceController { @GetMapping("/getRunStatusCount") public ResultRespons getRunStatusCount(HttpServletRequest request){ UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); - List> list=deviceInfoService.getDeviceRunStautsCount(userInfo.getOrg()); + List> list=deviceInfoService.getDeviceRunStatusCount(userInfo.getOrg()); if(list!=null){ return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",list); } @@ -97,9 +97,6 @@ public class DeviceController { @GetMapping("/updateDeviceStatus") public ResultRespons updateDeviceStatus(HttpServletRequest request){ UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); - if(userInfo==null){ - return new ResultRespons(Constant.SessionTimeOut_CODE,"用户尚未登录,请先登录!"); - } List list=deviceInfoService.selectActiveDevice(userInfo.getOrg()); if(list!=null){ return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",list); diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraDeviceController.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraDeviceController.java new file mode 100644 index 0000000..3df3384 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraDeviceController.java @@ -0,0 +1,87 @@ +package com.aiit.xiuos.controller; + +import com.aiit.xiuos.Utils.Constant; +import com.aiit.xiuos.Utils.ResultRespons; +import com.aiit.xiuos.model.LoraDeviceInfo; +import com.aiit.xiuos.model.UserInfo; +import com.aiit.xiuos.service.LoraDeviceInfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +@RestController +@Slf4j +@RequestMapping("/loraDevice") +public class LoraDeviceController { + @Autowired + LoraDeviceInfoService loraDeviceInfoService; + @PostMapping("/add") + public ResultRespons addInfo (@RequestBody LoraDeviceInfo loraDeviceInfo, HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + loraDeviceInfo.setOrg(userInfo.getOrg()); + int res = loraDeviceInfoService.addInfo(loraDeviceInfo); + if(1==res){ + return new ResultRespons(Constant.SUCCESS_CODE,"新增lora设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"新增lora设备信息失败!"); + } + + @PostMapping("/update") + public ResultRespons updateInfo (@RequestBody LoraDeviceInfo loraDeviceInfo) { + int res = loraDeviceInfoService.updateInfo(loraDeviceInfo); + if(res>=0){ + return new ResultRespons(Constant.SUCCESS_CODE,"更新lora设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"更新lora设备信息失败!"); + } + + @PostMapping("/delete") + public ResultRespons deleteInfo (@RequestBody LoraDeviceInfo loraDeviceInfo) { + int res = loraDeviceInfoService.deleteInfo(loraDeviceInfo.getDevEui()); + if(1==res){ + return new ResultRespons(Constant.SUCCESS_CODE,"删除lora设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"删除lora设备信息失败!"); + } + + @GetMapping("/select") + public ResultRespons getInfo (@RequestParam("gatewayid") String id,HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + List res =null; + if(StringUtils.isEmpty(id)){ + res = loraDeviceInfoService.selectInfo(userInfo.getOrg()); + }else{ + res = loraDeviceInfoService.selectInfoByGateway(id,userInfo.getOrg()); + } + + if(null!=res){ + return new ResultRespons(Constant.SUCCESS_CODE,"查询lora设备信息成功!",res); + } + return new ResultRespons(Constant.ERROR_CODE,"查询lora设备信息失败!"); + } + + @GetMapping("/getStatus") + public ResultRespons getStatus (HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + List> statusList = loraDeviceInfoService.getDeviceRunStatusCount(userInfo.getOrg()); + if(null!=statusList){ + return new ResultRespons(Constant.SUCCESS_CODE,"查询lora设备信息成功!",statusList); + } + return new ResultRespons(Constant.ERROR_CODE,"查询lora设备信息失败!"); + } + + @PostMapping("/offline") + public ResultRespons setDeviceOffLine (HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + int res = loraDeviceInfoService.setDeviceOffline(userInfo.getOrg()); + if(res>=0){ + return new ResultRespons(Constant.SUCCESS_CODE,"更新lora设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"更新lora设备信息失败!"); + } +} diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraGatewayController.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraGatewayController.java new file mode 100644 index 0000000..7808711 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/LoraGatewayController.java @@ -0,0 +1,82 @@ +package com.aiit.xiuos.controller; + +import com.aiit.xiuos.Utils.Constant; +import com.aiit.xiuos.Utils.ResultRespons; +import com.aiit.xiuos.model.LoraDeviceInfo; +import com.aiit.xiuos.model.LoraGatewayInfo; +import com.aiit.xiuos.model.UserInfo; +import com.aiit.xiuos.service.LoraDeviceInfoService; +import com.aiit.xiuos.service.LoraGatewayInfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +@RestController +@Slf4j +@RequestMapping("/loraGateway") +public class LoraGatewayController { + @Autowired + LoraGatewayInfoService loraGatewayInfoService; + @PostMapping("/add") + public ResultRespons addInfo (@RequestBody LoraGatewayInfo loraGatewayInfo, HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + loraGatewayInfo.setOrg(userInfo.getOrg()); + int res = loraGatewayInfoService.addGatewayInfo(loraGatewayInfo); + if(1==res){ + return new ResultRespons(Constant.SUCCESS_CODE,"新增lora网关信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"新增lora网关信息失败!"); + } + + @PostMapping("/update") + public ResultRespons updateInfo (@RequestBody LoraGatewayInfo loraGatewayInfo) { + int res = loraGatewayInfoService.updateGatewayInfo(loraGatewayInfo); + if(res>=0){ + return new ResultRespons(Constant.SUCCESS_CODE,"更新lora设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"更新lora设备信息失败!"); + } + + @PostMapping("/delete") + public ResultRespons deleteInfo (@RequestBody LoraGatewayInfo loraGatewayInfo) { + int res = loraGatewayInfoService.deleteGatewayInfo(loraGatewayInfo.getGatewayid()); + if(1==res){ + return new ResultRespons(Constant.SUCCESS_CODE,"删除lora网关设备信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"删除lora网关设备信息失败!"); + } + + @GetMapping("/select") + public ResultRespons getInfo (HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + List res = loraGatewayInfoService.selectGatewayInfo(userInfo.getOrg()); + if(null!=res){ + return new ResultRespons(Constant.SUCCESS_CODE,"查询lora网关信息成功!",res); + } + return new ResultRespons(Constant.ERROR_CODE,"查询lora网关信息失败!"); + } + + @GetMapping("/getStatus") + public ResultRespons getStatus (HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + List> statusList = loraGatewayInfoService.getGatewayRunStatusCount(userInfo.getOrg()); + if(null!=statusList){ + return new ResultRespons(Constant.SUCCESS_CODE,"查询lora设备信息成功!",statusList); + } + return new ResultRespons(Constant.ERROR_CODE,"查询lora设备信息失败!"); + } + + @PostMapping("/offline") + public ResultRespons setGatewayOffLine (HttpServletRequest request) { + UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user"); + int res = loraGatewayInfoService.setGatewayOffline(userInfo.getOrg()); + if(res>=0){ + return new ResultRespons(Constant.SUCCESS_CODE,"更新lora网关信息成功!"); + } + return new ResultRespons(Constant.ERROR_CODE,"更新lora网关信息失败!"); + } +} diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraDeviceInfoMapper.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraDeviceInfoMapper.java new file mode 100644 index 0000000..a0d5c33 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraDeviceInfoMapper.java @@ -0,0 +1,38 @@ +package com.aiit.xiuos.dao.mappers; + +import com.aiit.xiuos.model.LoraDeviceInfo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository +public interface LoraDeviceInfoMapper { + int deleteByPrimaryKey(String deveui); + + int insert(LoraDeviceInfo record); + + int insertSelective(LoraDeviceInfo record); + + LoraDeviceInfo selectByPrimaryKey(String deveui); + + int updateByPrimaryKeySelective(LoraDeviceInfo record); + + int updateByPrimaryKey(LoraDeviceInfo record); + + @Select("select * from lora_device_info where org=#{org}") + List selectAll(@Param("org") String org); + + @Select("select * from lora_device_info where gatewayId=#{id} and org=#{org}") + List selectById(@Param("id") String id,@Param("org") String org); + + + @Select("select d.status ,count(d.status) from lora_device_info d where org = #{org} GROUP BY d.status") + List> getDeviceRunStatusCount(@Param("org") String org); + + @Update("update lora_device_info set status= 2 where status = 1 and org = #{org} ") + int setDeviceOffLine(@Param("org") String org); +} \ No newline at end of file diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraGatewayInfoMapper.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraGatewayInfoMapper.java new file mode 100644 index 0000000..ff0a7bc --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/LoraGatewayInfoMapper.java @@ -0,0 +1,35 @@ +package com.aiit.xiuos.dao.mappers; + +import com.aiit.xiuos.model.LoraDeviceInfo; +import com.aiit.xiuos.model.LoraGatewayInfo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository +public interface LoraGatewayInfoMapper { + int deleteByPrimaryKey(String gatewayid); + + int insert(LoraGatewayInfo record); + + int insertSelective(LoraGatewayInfo record); + + LoraGatewayInfo selectByPrimaryKey(String gatewayid); + + int updateByPrimaryKeySelective(LoraGatewayInfo record); + + int updateByPrimaryKey(LoraGatewayInfo record); + + @Select("select * from lora_gateway_info where org=#{org}") + List selectAll(@Param("org") String org); + + @Select("select d.status ,count(d.status) from lora_gateway_info d where org = #{org} GROUP BY d.status") + List> getGatewayRunStatusCount(@Param("org") String org); + + @Update("update lora_gateway_info set status= 2 where status = 1 and org = #{org} ") + int setGatewayOffLine(@Param("org") String org); +} \ No newline at end of file diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraDeviceInfo.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraDeviceInfo.java new file mode 100644 index 0000000..f1ddcb9 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraDeviceInfo.java @@ -0,0 +1,57 @@ +package com.aiit.xiuos.model; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class LoraDeviceInfo { + private String devEui; + + private String joinEui; + + private String name; + + private String appKey; + + private Boolean supportOtaa; + + private Boolean supportClassc; + + private String gatewayid; + + private String remark1; + + private String remark2; + + private String org; + + private String remark3; + + private String remark4; + + private Integer status; + + private String remark5; + + public LoraDeviceInfo(String devEui, String joinEui, String name, String appKey, Boolean supportOtaa, Boolean supportClassc, String gatewayid, String remark1, String remark2, String org, String remark3, String remark4, Integer status, String remark5) { + this.devEui = devEui; + this.joinEui = joinEui; + this.name = name; + this.appKey = appKey; + this.supportOtaa = supportOtaa; + this.supportClassc = supportClassc; + this.gatewayid = gatewayid; + this.remark1 = remark1; + this.remark2 = remark2; + this.org = org; + this.remark3 = remark3; + this.remark4 = remark4; + this.status = status; + this.remark5 = remark5; + } + + public LoraDeviceInfo() { + super(); + } +} \ No newline at end of file diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraGatewayInfo.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraGatewayInfo.java new file mode 100644 index 0000000..fdb6172 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/model/LoraGatewayInfo.java @@ -0,0 +1,51 @@ +package com.aiit.xiuos.model; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class LoraGatewayInfo { + private String gatewayid; + + private String name; + + private Integer deviceNum; + @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private Date lastConnect; + + private Integer status; + + private String org; + + private String remark1; + + private String remark2; + + private String remark3; + + private String remark4; + + private String remark5; + + public LoraGatewayInfo(String gatewayid, String name, Integer deviceNum, Date lastConnect, Integer status, String org, String remark1, String remark2, String remark3, String remark4, String remark5) { + this.gatewayid = gatewayid; + this.name = name; + this.deviceNum = deviceNum; + this.lastConnect = lastConnect; + this.status = status; + this.org = org; + this.remark1 = remark1; + this.remark2 = remark2; + this.remark3 = remark3; + this.remark4 = remark4; + this.remark5 = remark5; + } + + public LoraGatewayInfo() { + super(); + } +} \ No newline at end of file diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/DeviceInfoService.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/DeviceInfoService.java index 4566e30..874b3fb 100644 --- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/DeviceInfoService.java +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/DeviceInfoService.java @@ -13,7 +13,7 @@ public interface DeviceInfoService { List selectUnActiveDevice(String org); DeviceInfo selectbyNo(String no); List> getDeviceTypeCount(String org); - List> getDeviceRunStautsCount(String org); + List> getDeviceRunStatusCount(String org); String getTypeByName(String deviceNo); List getDeviceList(String org); int updateDeviceInfo(DeviceInfo deviceInfo); diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraDeviceInfoService.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraDeviceInfoService.java new file mode 100644 index 0000000..0f3ea26 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraDeviceInfoService.java @@ -0,0 +1,16 @@ +package com.aiit.xiuos.service; + +import com.aiit.xiuos.model.LoraDeviceInfo; + +import java.util.List; +import java.util.Map; + +public interface LoraDeviceInfoService { + int addInfo (LoraDeviceInfo loraDeviceInfo); + int updateInfo(LoraDeviceInfo loraDeviceInfo); + int deleteInfo (String deveui); + List selectInfo(String org); + List selectInfoByGateway(String id,String org); + List> getDeviceRunStatusCount(String org); + int setDeviceOffline (String org); +} diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraGatewayInfoService.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraGatewayInfoService.java new file mode 100644 index 0000000..35b7611 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/LoraGatewayInfoService.java @@ -0,0 +1,15 @@ +package com.aiit.xiuos.service; + +import com.aiit.xiuos.model.LoraGatewayInfo; + +import java.util.List; +import java.util.Map; + +public interface LoraGatewayInfoService { + int addGatewayInfo(LoraGatewayInfo loraGatewayInfo); + int updateGatewayInfo(LoraGatewayInfo loraGatewayInfo); + List selectGatewayInfo(String org); + int deleteGatewayInfo(String gatewayId); + List> getGatewayRunStatusCount(String org); + int setGatewayOffline (String org); +} diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/DeviceInfoServiceImpl.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/DeviceInfoServiceImpl.java index b309455..7209212 100644 --- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/DeviceInfoServiceImpl.java +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/DeviceInfoServiceImpl.java @@ -52,7 +52,7 @@ public class DeviceInfoServiceImpl implements DeviceInfoService { } @Override - public List> getDeviceRunStautsCount(String org) { + public List> getDeviceRunStatusCount(String org) { return deviceInfoMapper.getDeviceRunStatusCount(org); } diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraDeviceInfoServiceImpl.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraDeviceInfoServiceImpl.java new file mode 100644 index 0000000..6d9d23a --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraDeviceInfoServiceImpl.java @@ -0,0 +1,51 @@ +package com.aiit.xiuos.service.impl; + +import com.aiit.xiuos.dao.mappers.LoraDeviceInfoMapper; +import com.aiit.xiuos.model.LoraDeviceInfo; +import com.aiit.xiuos.service.LoraDeviceInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class LoraDeviceInfoServiceImpl implements LoraDeviceInfoService { + @Autowired + LoraDeviceInfoMapper loraDeviceInfoMapper; + + @Override + public int addInfo(LoraDeviceInfo loraDeviceInfo) { + return loraDeviceInfoMapper.insert(loraDeviceInfo); + } + + @Override + public int updateInfo(LoraDeviceInfo loraDeviceInfo) { + return loraDeviceInfoMapper.updateByPrimaryKeySelective(loraDeviceInfo); + } + + @Override + public int deleteInfo(String deveui) { + return loraDeviceInfoMapper.deleteByPrimaryKey(deveui); + } + + @Override + public List selectInfo(String org) { + return loraDeviceInfoMapper.selectAll(org); + } + + @Override + public List selectInfoByGateway(String id, String org) { + return loraDeviceInfoMapper.selectById(id,org); + } + + @Override + public List> getDeviceRunStatusCount(String org) { + return loraDeviceInfoMapper.getDeviceRunStatusCount(org); + } + + @Override + public int setDeviceOffline(String org) { + return loraDeviceInfoMapper.setDeviceOffLine(org); + } +} diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraGatewayInfoServiceImpl.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraGatewayInfoServiceImpl.java new file mode 100644 index 0000000..4162845 --- /dev/null +++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/LoraGatewayInfoServiceImpl.java @@ -0,0 +1,45 @@ +package com.aiit.xiuos.service.impl; + +import com.aiit.xiuos.dao.mappers.LoraDeviceInfoMapper; +import com.aiit.xiuos.dao.mappers.LoraGatewayInfoMapper; +import com.aiit.xiuos.model.LoraGatewayInfo; +import com.aiit.xiuos.service.LoraGatewayInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class LoraGatewayInfoServiceImpl implements LoraGatewayInfoService { + @Autowired + LoraGatewayInfoMapper loraGatewayInfoMapper; + @Override + public int addGatewayInfo(LoraGatewayInfo loraGatewayInfo) { + return loraGatewayInfoMapper.insert(loraGatewayInfo); + } + + @Override + public int updateGatewayInfo(LoraGatewayInfo loraGatewayInfo) { + return loraGatewayInfoMapper.updateByPrimaryKeySelective(loraGatewayInfo); + } + + @Override + public List selectGatewayInfo(String org) { + return loraGatewayInfoMapper.selectAll(org); + } + + @Override + public int deleteGatewayInfo(String gatewayId) { + return loraGatewayInfoMapper.deleteByPrimaryKey(gatewayId); + } + @Override + public List> getGatewayRunStatusCount(String org) { + return loraGatewayInfoMapper.getGatewayRunStatusCount(org); + } + + @Override + public int setGatewayOffline(String org) { + return loraGatewayInfoMapper.setGatewayOffLine(org); + } +} diff --git a/xiuosiot-backend/src/main/resources/mappers/LoraDeviceInfoMapper.xml b/xiuosiot-backend/src/main/resources/mappers/LoraDeviceInfoMapper.xml new file mode 100644 index 0000000..0f768cf --- /dev/null +++ b/xiuosiot-backend/src/main/resources/mappers/LoraDeviceInfoMapper.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + dev_EUI, join_EUI, name, app_key, support_OTAA, support_ClassC, gatewayId, remark1, + remark2, org, remark3, remark4, status, remark5 + + + + delete from lora_device_info + where dev_EUI = #{devEui,jdbcType=VARCHAR} + + + insert into lora_device_info (dev_EUI, join_EUI, name, + app_key, support_OTAA, support_ClassC, + gatewayId, remark1, remark2, + org, remark3, remark4, + status, remark5) + values (#{devEui,jdbcType=VARCHAR}, #{joinEui,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{appKey,jdbcType=VARCHAR}, #{supportOtaa,jdbcType=BIT}, #{supportClassc,jdbcType=BIT}, + #{gatewayid,jdbcType=VARCHAR}, #{remark1,jdbcType=VARCHAR}, #{remark2,jdbcType=VARCHAR}, + #{org,jdbcType=VARCHAR}, #{remark3,jdbcType=VARCHAR}, #{remark4,jdbcType=VARCHAR}, + #{status,jdbcType=INTEGER}, #{remark5,jdbcType=VARCHAR}) + + + insert into lora_device_info + + + dev_EUI, + + + join_EUI, + + + name, + + + app_key, + + + support_OTAA, + + + support_ClassC, + + + gatewayId, + + + remark1, + + + remark2, + + + org, + + + remark3, + + + remark4, + + + status, + + + remark5, + + + + + #{devEui,jdbcType=VARCHAR}, + + + #{joinEui,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{appKey,jdbcType=VARCHAR}, + + + #{supportOtaa,jdbcType=BIT}, + + + #{supportClassc,jdbcType=BIT}, + + + #{gatewayid,jdbcType=VARCHAR}, + + + #{remark1,jdbcType=VARCHAR}, + + + #{remark2,jdbcType=VARCHAR}, + + + #{org,jdbcType=VARCHAR}, + + + #{remark3,jdbcType=VARCHAR}, + + + #{remark4,jdbcType=VARCHAR}, + + + #{status,jdbcType=INTEGER}, + + + #{remark5,jdbcType=VARCHAR}, + + + + + update lora_device_info + + + join_EUI = #{joinEui,jdbcType=VARCHAR}, + + + name = #{name,jdbcType=VARCHAR}, + + + app_key = #{appKey,jdbcType=VARCHAR}, + + + support_OTAA = #{supportOtaa,jdbcType=BIT}, + + + support_ClassC = #{supportClassc,jdbcType=BIT}, + + + gatewayId = #{gatewayid,jdbcType=VARCHAR}, + + + remark1 = #{remark1,jdbcType=VARCHAR}, + + + remark2 = #{remark2,jdbcType=VARCHAR}, + + + org = #{org,jdbcType=VARCHAR}, + + + remark3 = #{remark3,jdbcType=VARCHAR}, + + + remark4 = #{remark4,jdbcType=VARCHAR}, + + + status = #{status,jdbcType=INTEGER}, + + + remark5 = #{remark5,jdbcType=VARCHAR}, + + + where dev_EUI = #{devEui,jdbcType=VARCHAR} + + + update lora_device_info + set join_EUI = #{joinEui,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + app_key = #{appKey,jdbcType=VARCHAR}, + support_OTAA = #{supportOtaa,jdbcType=BIT}, + support_ClassC = #{supportClassc,jdbcType=BIT}, + gatewayId = #{gatewayid,jdbcType=VARCHAR}, + remark1 = #{remark1,jdbcType=VARCHAR}, + remark2 = #{remark2,jdbcType=VARCHAR}, + org = #{org,jdbcType=VARCHAR}, + remark3 = #{remark3,jdbcType=VARCHAR}, + remark4 = #{remark4,jdbcType=VARCHAR}, + status = #{status,jdbcType=INTEGER}, + remark5 = #{remark5,jdbcType=VARCHAR} + where dev_EUI = #{devEui,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/xiuosiot-backend/src/main/resources/mappers/LoraGatewayInfoMapper.xml b/xiuosiot-backend/src/main/resources/mappers/LoraGatewayInfoMapper.xml new file mode 100644 index 0000000..223fde1 --- /dev/null +++ b/xiuosiot-backend/src/main/resources/mappers/LoraGatewayInfoMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + gatewayId, name, device_num, last_connect, status, org, remark1, remark2, remark3, + remark4, remark5 + + + + delete from lora_gateway_info + where gatewayId = #{gatewayid,jdbcType=VARCHAR} + + + insert into lora_gateway_info (gatewayId, name, device_num, + last_connect, status, org, + remark1, remark2, remark3, + remark4, remark5) + values (#{gatewayid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{deviceNum,jdbcType=INTEGER}, + #{lastConnect,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{org,jdbcType=VARCHAR}, + #{remark1,jdbcType=VARCHAR}, #{remark2,jdbcType=VARCHAR}, #{remark3,jdbcType=VARCHAR}, + #{remark4,jdbcType=VARCHAR}, #{remark5,jdbcType=VARCHAR}) + + + insert into lora_gateway_info + + + gatewayId, + + + name, + + + device_num, + + + last_connect, + + + status, + + + org, + + + remark1, + + + remark2, + + + remark3, + + + remark4, + + + remark5, + + + + + #{gatewayid,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{deviceNum,jdbcType=INTEGER}, + + + #{lastConnect,jdbcType=TIMESTAMP}, + + + #{status,jdbcType=INTEGER}, + + + #{org,jdbcType=VARCHAR}, + + + #{remark1,jdbcType=VARCHAR}, + + + #{remark2,jdbcType=VARCHAR}, + + + #{remark3,jdbcType=VARCHAR}, + + + #{remark4,jdbcType=VARCHAR}, + + + #{remark5,jdbcType=VARCHAR}, + + + + + update lora_gateway_info + + + name = #{name,jdbcType=VARCHAR}, + + + device_num = #{deviceNum,jdbcType=INTEGER}, + + + last_connect = #{lastConnect,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=INTEGER}, + + + org = #{org,jdbcType=VARCHAR}, + + + remark1 = #{remark1,jdbcType=VARCHAR}, + + + remark2 = #{remark2,jdbcType=VARCHAR}, + + + remark3 = #{remark3,jdbcType=VARCHAR}, + + + remark4 = #{remark4,jdbcType=VARCHAR}, + + + remark5 = #{remark5,jdbcType=VARCHAR}, + + + where gatewayId = #{gatewayid,jdbcType=VARCHAR} + + + update lora_gateway_info + set name = #{name,jdbcType=VARCHAR}, + device_num = #{deviceNum,jdbcType=INTEGER}, + last_connect = #{lastConnect,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=INTEGER}, + org = #{org,jdbcType=VARCHAR}, + remark1 = #{remark1,jdbcType=VARCHAR}, + remark2 = #{remark2,jdbcType=VARCHAR}, + remark3 = #{remark3,jdbcType=VARCHAR}, + remark4 = #{remark4,jdbcType=VARCHAR}, + remark5 = #{remark5,jdbcType=VARCHAR} + where gatewayId = #{gatewayid,jdbcType=VARCHAR} + + \ No newline at end of file