add lora device and lora gateway controller、service、mapper
This commit is contained in:
parent
77d5a1ab49
commit
6107aeb0a4
|
@ -87,7 +87,7 @@ public class DeviceController {
|
|||
@GetMapping("/getRunStatusCount")
|
||||
public ResultRespons getRunStatusCount(HttpServletRequest request){
|
||||
UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user");
|
||||
List<Map<String,String>> list=deviceInfoService.getDeviceRunStautsCount(userInfo.getOrg());
|
||||
List<Map<String,String>> 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<DeviceInfo> list=deviceInfoService.selectActiveDevice(userInfo.getOrg());
|
||||
if(list!=null){
|
||||
return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",list);
|
||||
|
|
|
@ -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<LoraDeviceInfo> 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<Map<String,String>> 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设备信息失败!");
|
||||
}
|
||||
}
|
|
@ -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<LoraGatewayInfo> 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<Map<String,String>> 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网关信息失败!");
|
||||
}
|
||||
}
|
|
@ -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<LoraDeviceInfo> selectAll(@Param("org") String org);
|
||||
|
||||
@Select("select * from lora_device_info where gatewayId=#{id} and org=#{org}")
|
||||
List<LoraDeviceInfo> 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<Map<String,String>> 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);
|
||||
}
|
|
@ -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<LoraGatewayInfo> 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<Map<String,String>> 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);
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ public interface DeviceInfoService {
|
|||
List<DeviceInfo> selectUnActiveDevice(String org);
|
||||
DeviceInfo selectbyNo(String no);
|
||||
List<Map<String,String>> getDeviceTypeCount(String org);
|
||||
List<Map<String,String>> getDeviceRunStautsCount(String org);
|
||||
List<Map<String,String>> getDeviceRunStatusCount(String org);
|
||||
String getTypeByName(String deviceNo);
|
||||
List<String> getDeviceList(String org);
|
||||
int updateDeviceInfo(DeviceInfo deviceInfo);
|
||||
|
|
|
@ -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<LoraDeviceInfo> selectInfo(String org);
|
||||
List<LoraDeviceInfo> selectInfoByGateway(String id,String org);
|
||||
List<Map<String,String>> getDeviceRunStatusCount(String org);
|
||||
int setDeviceOffline (String org);
|
||||
}
|
|
@ -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<LoraGatewayInfo> selectGatewayInfo(String org);
|
||||
int deleteGatewayInfo(String gatewayId);
|
||||
List<Map<String,String>> getGatewayRunStatusCount(String org);
|
||||
int setGatewayOffline (String org);
|
||||
}
|
|
@ -52,7 +52,7 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getDeviceRunStautsCount(String org) {
|
||||
public List<Map<String, String>> getDeviceRunStatusCount(String org) {
|
||||
return deviceInfoMapper.getDeviceRunStatusCount(org);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<LoraDeviceInfo> selectInfo(String org) {
|
||||
return loraDeviceInfoMapper.selectAll(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoraDeviceInfo> selectInfoByGateway(String id, String org) {
|
||||
return loraDeviceInfoMapper.selectById(id,org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,String>> getDeviceRunStatusCount(String org) {
|
||||
return loraDeviceInfoMapper.getDeviceRunStatusCount(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setDeviceOffline(String org) {
|
||||
return loraDeviceInfoMapper.setDeviceOffLine(org);
|
||||
}
|
||||
}
|
|
@ -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<LoraGatewayInfo> selectGatewayInfo(String org) {
|
||||
return loraGatewayInfoMapper.selectAll(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteGatewayInfo(String gatewayId) {
|
||||
return loraGatewayInfoMapper.deleteByPrimaryKey(gatewayId);
|
||||
}
|
||||
@Override
|
||||
public List<Map<String,String>> getGatewayRunStatusCount(String org) {
|
||||
return loraGatewayInfoMapper.getGatewayRunStatusCount(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setGatewayOffline(String org) {
|
||||
return loraGatewayInfoMapper.setGatewayOffLine(org);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aiit.xiuos.dao.mappers.LoraDeviceInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aiit.xiuos.model.LoraDeviceInfo">
|
||||
<constructor>
|
||||
<idArg column="dev_EUI" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="join_EUI" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="app_key" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="support_OTAA" javaType="java.lang.Boolean" jdbcType="BIT" />
|
||||
<arg column="support_ClassC" javaType="java.lang.Boolean" jdbcType="BIT" />
|
||||
<arg column="gatewayId" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark1" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark2" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="org" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark3" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark4" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="status" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
||||
<arg column="remark5" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
</constructor>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
dev_EUI, join_EUI, name, app_key, support_OTAA, support_ClassC, gatewayId, remark1,
|
||||
remark2, org, remark3, remark4, status, remark5
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from lora_device_info
|
||||
where dev_EUI = #{devEui,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from lora_device_info
|
||||
where dev_EUI = #{devEui,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.aiit.xiuos.model.LoraDeviceInfo">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="com.aiit.xiuos.model.LoraDeviceInfo">
|
||||
insert into lora_device_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="devEui != null">
|
||||
dev_EUI,
|
||||
</if>
|
||||
<if test="joinEui != null">
|
||||
join_EUI,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="appKey != null">
|
||||
app_key,
|
||||
</if>
|
||||
<if test="supportOtaa != null">
|
||||
support_OTAA,
|
||||
</if>
|
||||
<if test="supportClassc != null">
|
||||
support_ClassC,
|
||||
</if>
|
||||
<if test="gatewayid != null">
|
||||
gatewayId,
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
remark1,
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
remark2,
|
||||
</if>
|
||||
<if test="org != null">
|
||||
org,
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
remark3,
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
remark4,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
remark5,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="devEui != null">
|
||||
#{devEui,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="joinEui != null">
|
||||
#{joinEui,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appKey != null">
|
||||
#{appKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="supportOtaa != null">
|
||||
#{supportOtaa,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="supportClassc != null">
|
||||
#{supportClassc,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="gatewayid != null">
|
||||
#{gatewayid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
#{remark1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
#{remark2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="org != null">
|
||||
#{org,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
#{remark3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
#{remark4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
#{remark5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.LoraDeviceInfo">
|
||||
update lora_device_info
|
||||
<set>
|
||||
<if test="joinEui != null">
|
||||
join_EUI = #{joinEui,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appKey != null">
|
||||
app_key = #{appKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="supportOtaa != null">
|
||||
support_OTAA = #{supportOtaa,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="supportClassc != null">
|
||||
support_ClassC = #{supportClassc,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="gatewayid != null">
|
||||
gatewayId = #{gatewayid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
remark1 = #{remark1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
remark2 = #{remark2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="org != null">
|
||||
org = #{org,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
remark3 = #{remark3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
remark4 = #{remark4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
remark5 = #{remark5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where dev_EUI = #{devEui,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.aiit.xiuos.model.LoraDeviceInfo">
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,166 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aiit.xiuos.dao.mappers.LoraGatewayInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aiit.xiuos.model.LoraGatewayInfo">
|
||||
<constructor>
|
||||
<idArg column="gatewayId" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="device_num" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
||||
<arg column="last_connect" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
||||
<arg column="status" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
||||
<arg column="org" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark1" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark2" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark3" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark4" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<arg column="remark5" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
</constructor>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
gatewayId, name, device_num, last_connect, status, org, remark1, remark2, remark3,
|
||||
remark4, remark5
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from lora_gateway_info
|
||||
where gatewayId = #{gatewayid,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from lora_gateway_info
|
||||
where gatewayId = #{gatewayid,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.aiit.xiuos.model.LoraGatewayInfo">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="com.aiit.xiuos.model.LoraGatewayInfo">
|
||||
insert into lora_gateway_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="gatewayid != null">
|
||||
gatewayId,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="deviceNum != null">
|
||||
device_num,
|
||||
</if>
|
||||
<if test="lastConnect != null">
|
||||
last_connect,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="org != null">
|
||||
org,
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
remark1,
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
remark2,
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
remark3,
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
remark4,
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
remark5,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="gatewayid != null">
|
||||
#{gatewayid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deviceNum != null">
|
||||
#{deviceNum,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="lastConnect != null">
|
||||
#{lastConnect,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="org != null">
|
||||
#{org,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
#{remark1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
#{remark2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
#{remark3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
#{remark4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
#{remark5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.LoraGatewayInfo">
|
||||
update lora_gateway_info
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deviceNum != null">
|
||||
device_num = #{deviceNum,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="lastConnect != null">
|
||||
last_connect = #{lastConnect,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="org != null">
|
||||
org = #{org,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark1 != null">
|
||||
remark1 = #{remark1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark2 != null">
|
||||
remark2 = #{remark2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark3 != null">
|
||||
remark3 = #{remark3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark4 != null">
|
||||
remark4 = #{remark4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark5 != null">
|
||||
remark5 = #{remark5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where gatewayId = #{gatewayid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.aiit.xiuos.model.LoraGatewayInfo">
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue