mirror of
https://github.com/kerwincui/FastBee.git
synced 2025-10-09 18:11:21 +08:00
添加扫码添加设备接口
This commit is contained in:
@@ -8,6 +8,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.iot.domain.Device;
|
import com.ruoyi.iot.domain.Device;
|
||||||
import com.ruoyi.iot.model.DeviceAllShortOutput;
|
import com.ruoyi.iot.model.DeviceAllShortOutput;
|
||||||
|
import com.ruoyi.iot.model.DeviceRelateUserInput;
|
||||||
import com.ruoyi.iot.model.DeviceShortOutput;
|
import com.ruoyi.iot.model.DeviceShortOutput;
|
||||||
import com.ruoyi.iot.mqtt.EmqxService;
|
import com.ruoyi.iot.mqtt.EmqxService;
|
||||||
import com.ruoyi.iot.service.IDeviceService;
|
import com.ruoyi.iot.service.IDeviceService;
|
||||||
@@ -173,7 +174,7 @@ public class DeviceController extends BaseController
|
|||||||
* 新增设备
|
* 新增设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@Log(title = "设备", businessType = BusinessType.INSERT)
|
@Log(title = "添加设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("添加设备")
|
@ApiOperation("添加设备")
|
||||||
public AjaxResult add(@RequestBody Device device)
|
public AjaxResult add(@RequestBody Device device)
|
||||||
@@ -181,11 +182,29 @@ public class DeviceController extends BaseController
|
|||||||
return AjaxResult.success(deviceService.insertDevice(device));
|
return AjaxResult.success(deviceService.insertDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备关联用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
|
@Log(title = "设备关联用户", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/relateUser")
|
||||||
|
@ApiOperation("设备关联用户")
|
||||||
|
public AjaxResult relateUser(@RequestBody DeviceRelateUserInput deviceRelateUserInput)
|
||||||
|
{
|
||||||
|
if(deviceRelateUserInput.getUserId()==0 || deviceRelateUserInput.getUserId()==null){
|
||||||
|
return AjaxResult.error("用户ID不能为空");
|
||||||
|
}
|
||||||
|
if(deviceRelateUserInput.getDeviceNumberAndProductIds()==null || deviceRelateUserInput.getDeviceNumberAndProductIds().size()==0){
|
||||||
|
return AjaxResult.error("设备编号和产品ID不能为空");
|
||||||
|
}
|
||||||
|
return deviceService.deviceRelateUser(deviceRelateUserInput);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备
|
* 修改设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||||
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改设备")
|
@ApiOperation("修改设备")
|
||||||
public AjaxResult edit(@RequestBody Device device)
|
public AjaxResult edit(@RequestBody Device device)
|
||||||
@@ -197,9 +216,9 @@ public class DeviceController extends BaseController
|
|||||||
* 重置设备状态
|
* 重置设备状态
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||||
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/reset/{serialNumber}")
|
@PutMapping("/reset/{serialNumber}")
|
||||||
@ApiOperation("重置设备设备")
|
@ApiOperation("重置设备状态")
|
||||||
public AjaxResult resetDeviceStatus(@PathVariable String serialNumber)
|
public AjaxResult resetDeviceStatus(@PathVariable String serialNumber)
|
||||||
{
|
{
|
||||||
Device device=new Device();
|
Device device=new Device();
|
||||||
@@ -211,13 +230,16 @@ public class DeviceController extends BaseController
|
|||||||
* 删除设备
|
* 删除设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||||
@Log(title = "设备", businessType = BusinessType.DELETE)
|
@Log(title = "删除设备", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceIds}")
|
@DeleteMapping("/{deviceIds}")
|
||||||
@ApiOperation("批量删除设备")
|
@ApiOperation("批量删除设备")
|
||||||
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
||||||
return toAjax(deviceService.deleteDeviceByDeviceId(deviceIds[0]));
|
return toAjax(deviceService.deleteDeviceByDeviceId(deviceIds[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成设备编号
|
||||||
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||||
@GetMapping("/generator")
|
@GetMapping("/generator")
|
||||||
@ApiOperation("生成设备编号")
|
@ApiOperation("生成设备编号")
|
||||||
|
@@ -40,6 +40,15 @@ public interface DeviceMapper
|
|||||||
*/
|
*/
|
||||||
public Device selectDeviceBySerialNumber(String serialNumber);
|
public Device selectDeviceBySerialNumber(String serialNumber);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号查询设备数量
|
||||||
|
*
|
||||||
|
* @param serialNumber 设备主键
|
||||||
|
* @return 设备
|
||||||
|
*/
|
||||||
|
public int selectDeviceCountBySerialNumber(String serialNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编号查询简介设备
|
* 根据设备编号查询简介设备
|
||||||
*
|
*
|
||||||
|
@@ -50,10 +50,10 @@ public interface DeviceUserMapper
|
|||||||
/**
|
/**
|
||||||
* 删除设备用户
|
* 删除设备用户
|
||||||
*
|
*
|
||||||
* @param UserIdAndDeviceIdModel 用户ID和设备ID
|
* @param UserIdDeviceIdModel 用户ID和设备ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeviceUserByDeviceId(UserIdDeviceIdModel userDeviceGroupIdModel);
|
public int deleteDeviceUserByDeviceId(UserIdDeviceIdModel UserIdDeviceIdModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除设备用户
|
* 批量删除设备用户
|
||||||
@@ -78,5 +78,9 @@ public interface DeviceUserMapper
|
|||||||
*/
|
*/
|
||||||
public DeviceUser selectDeviceUserByDeviceIdAndUserId(@Param("deviceId") Long deviceId, @Param("userId") Long userId);
|
public DeviceUser selectDeviceUserByDeviceIdAndUserId(@Param("deviceId") Long deviceId, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据deviceId 和 userId 删除设备用户,不包含设备所有者
|
||||||
|
*/
|
||||||
public int deleteDeviceUser(DeviceUser deviceUser);
|
public int deleteDeviceUser(DeviceUser deviceUser);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
package com.ruoyi.iot.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-12-16
|
||||||
|
*/
|
||||||
|
public class DeviceNumberAndProductId
|
||||||
|
{
|
||||||
|
/** 产品ID,用于自动添加设备 */
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 设备编号集合 */
|
||||||
|
private String deviceNumber;
|
||||||
|
|
||||||
|
public DeviceNumberAndProductId(){}
|
||||||
|
|
||||||
|
public DeviceNumberAndProductId(Long productId, String deviceNumber){
|
||||||
|
this.productId=productId;
|
||||||
|
this.deviceNumber=deviceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Long productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceNumber() {
|
||||||
|
return deviceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceNumber(String deviceNumber) {
|
||||||
|
this.deviceNumber = deviceNumber;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ruoyi.iot.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-12-16
|
||||||
|
*/
|
||||||
|
public class DeviceRelateUserInput
|
||||||
|
{
|
||||||
|
|
||||||
|
/** 用户Id */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 设备编号和产品ID集合 */
|
||||||
|
private List<DeviceNumberAndProductId> deviceNumberAndProductIds;
|
||||||
|
|
||||||
|
public DeviceRelateUserInput(){}
|
||||||
|
|
||||||
|
public DeviceRelateUserInput(Long userId,List<DeviceNumberAndProductId> deviceNumberAndProductIds){
|
||||||
|
this.userId=userId;
|
||||||
|
this.deviceNumberAndProductIds=deviceNumberAndProductIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DeviceNumberAndProductId> getDeviceNumberAndProductIds() {
|
||||||
|
return deviceNumberAndProductIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceNumberAndProductIds(List<DeviceNumberAndProductId> deviceNumberAndProductIds) {
|
||||||
|
this.deviceNumberAndProductIds = deviceNumberAndProductIds;
|
||||||
|
}
|
||||||
|
}
|
@@ -118,6 +118,14 @@ public interface IDeviceService
|
|||||||
*/
|
*/
|
||||||
public Device insertDevice(Device device);
|
public Device insertDevice(Device device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备关联用户
|
||||||
|
*
|
||||||
|
* @param deviceRelateUserInput 设备
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult deviceRelateUser(DeviceRelateUserInput deviceRelateUserInput);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备认证后自动添加设备
|
* 设备认证后自动添加设备
|
||||||
*
|
*
|
||||||
|
@@ -551,10 +551,60 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
deviceUser.setTenantId(product.getTenantId());
|
deviceUser.setTenantId(product.getTenantId());
|
||||||
deviceUser.setTenantName(product.getTenantName());
|
deviceUser.setTenantName(product.getTenantName());
|
||||||
deviceUser.setIsOwner(1);
|
deviceUser.setIsOwner(1);
|
||||||
|
deviceUser.setCreateTime(DateUtils.getNowDate());
|
||||||
deviceUserMapper.insertDeviceUser(deviceUser);
|
deviceUserMapper.insertDeviceUser(deviceUser);
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备关联用户
|
||||||
|
*
|
||||||
|
* @param deviceRelateUserInput
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult deviceRelateUser(DeviceRelateUserInput deviceRelateUserInput) {
|
||||||
|
// 查询用户信息
|
||||||
|
SysUser sysUser = userService.selectUserById(deviceRelateUserInput.getUserId());
|
||||||
|
for (int i = 0; i < deviceRelateUserInput.getDeviceNumberAndProductIds().size(); i++) {
|
||||||
|
Device existDevice = deviceMapper.selectDeviceBySerialNumber(deviceRelateUserInput.getDeviceNumberAndProductIds().get(i).getDeviceNumber());
|
||||||
|
if (existDevice != null) {
|
||||||
|
if (existDevice.getUserId().longValue() == deviceRelateUserInput.getUserId().longValue()) {
|
||||||
|
return AjaxResult.error("用户已经拥有设备:" + existDevice.getDeviceName() + ", 设备编号:" + existDevice.getSerialNumber());
|
||||||
|
}
|
||||||
|
// 先删除设备的所有用户
|
||||||
|
deviceUserMapper.deleteDeviceUserByDeviceId(new UserIdDeviceIdModel(null,existDevice.getDeviceId()));
|
||||||
|
// 添加新的设备用户
|
||||||
|
DeviceUser deviceUser = new DeviceUser();
|
||||||
|
deviceUser.setUserId(sysUser.getUserId());
|
||||||
|
deviceUser.setUserName(sysUser.getUserName());
|
||||||
|
deviceUser.setPhonenumber(sysUser.getPhonenumber());
|
||||||
|
deviceUser.setDeviceId(existDevice.getDeviceId());
|
||||||
|
deviceUser.setDeviceName(existDevice.getDeviceName());
|
||||||
|
deviceUser.setTenantId(existDevice.getTenantId());
|
||||||
|
deviceUser.setTenantName(existDevice.getTenantName());
|
||||||
|
deviceUser.setIsOwner(1);
|
||||||
|
deviceUser.setCreateTime(DateUtils.getNowDate());
|
||||||
|
deviceUserMapper.insertDeviceUser(deviceUser);
|
||||||
|
// 更新设备用户信息
|
||||||
|
existDevice.setUserId(deviceRelateUserInput.getUserId());
|
||||||
|
existDevice.setUserName(sysUser.getUserName());
|
||||||
|
deviceMapper.updateDevice(existDevice);
|
||||||
|
} else {
|
||||||
|
// 自动添加设备
|
||||||
|
int result = insertDeviceAuto(
|
||||||
|
deviceRelateUserInput.getDeviceNumberAndProductIds().get(i).getDeviceNumber(),
|
||||||
|
deviceRelateUserInput.getUserId(),
|
||||||
|
deviceRelateUserInput.getDeviceNumberAndProductIds().get(i).getProductId());
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("设备不存在,自动添加设备时失败,请检查产品编号是否正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("添加设备成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备认证后自动添加设备
|
* 设备认证后自动添加设备
|
||||||
*
|
*
|
||||||
@@ -564,8 +614,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertDeviceAuto(String serialNumber, Long userId, Long productId) {
|
public int insertDeviceAuto(String serialNumber, Long userId, Long productId) {
|
||||||
// 设备编号唯一检查
|
// 设备编号唯一检查
|
||||||
Device existDevice=deviceMapper.selectDeviceBySerialNumber(serialNumber);
|
int count = deviceMapper.selectDeviceCountBySerialNumber(serialNumber);
|
||||||
if(existDevice!=null){
|
if (count != 0) {
|
||||||
log.error("设备编号:" + serialNumber + "已经存在了,新增设备失败");
|
log.error("设备编号:" + serialNumber + "已经存在了,新增设备失败");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -593,6 +643,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
device.setNetworkIp("127.0.0.1");
|
device.setNetworkIp("127.0.0.1");
|
||||||
// 设置租户
|
// 设置租户
|
||||||
Product product = productService.selectProductByProductId(productId);
|
Product product = productService.selectProductByProductId(productId);
|
||||||
|
if (product == null) {
|
||||||
|
log.error("自动添加设备时,根据产品ID查找不到对应产品");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
device.setTenantId(product.getTenantId());
|
device.setTenantId(product.getTenantId());
|
||||||
device.setTenantName(product.getTenantName());
|
device.setTenantName(product.getTenantName());
|
||||||
device.setImgUrl(product.getImgUrl());
|
device.setImgUrl(product.getImgUrl());
|
||||||
@@ -615,6 +669,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取物模型值
|
* 获取物模型值
|
||||||
|
*
|
||||||
* @param productId
|
* @param productId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -635,6 +690,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备设置的影子
|
* 获取设备设置的影子
|
||||||
|
*
|
||||||
* @param device
|
* @param device
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -686,6 +742,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备
|
* 修改设备
|
||||||
|
*
|
||||||
* @param device 设备
|
* @param device 设备
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -719,6 +776,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成设备唯一编号
|
* 生成设备唯一编号
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -737,7 +795,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param device 设备状态和定位更新
|
* @param device 设备状态和定位更新
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -786,7 +843,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param device 设备状态
|
* @param device 设备状态
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -797,6 +853,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据IP获取地址
|
* 根据IP获取地址
|
||||||
|
*
|
||||||
* @param ip
|
* @param ip
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -804,29 +861,26 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
|
String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
|
||||||
String address = "未知地址";
|
String address = "未知地址";
|
||||||
// 内网不查询
|
// 内网不查询
|
||||||
if (IpUtils.internalIp(ip))
|
if (IpUtils.internalIp(ip)) {
|
||||||
{
|
|
||||||
device.setNetworkAddress("内网IP");
|
device.setNetworkAddress("内网IP");
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
|
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
|
||||||
if (!StringUtils.isEmpty(rspStr))
|
if (!StringUtils.isEmpty(rspStr)) {
|
||||||
{
|
|
||||||
JSONObject obj = JSONObject.parseObject(rspStr);
|
JSONObject obj = JSONObject.parseObject(rspStr);
|
||||||
device.setNetworkAddress(obj.getString("addr"));
|
device.setNetworkAddress(obj.getString("addr"));
|
||||||
System.out.println(device.getSerialNumber() + "- 设置地址:" + obj.getString("addr"));
|
System.out.println(device.getSerialNumber() + "- 设置地址:" + obj.getString("addr"));
|
||||||
// 查询经纬度
|
// 查询经纬度
|
||||||
setLatitudeAndLongitude(obj.getString("city"), device);
|
setLatitudeAndLongitude(obj.getString("city"), device);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e){
|
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置经纬度
|
* 设置经纬度
|
||||||
|
*
|
||||||
* @param city
|
* @param city
|
||||||
*/
|
*/
|
||||||
private void setLatitudeAndLongitude(String city, Device device) {
|
private void setLatitudeAndLongitude(String city, Device device) {
|
||||||
@@ -843,6 +897,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 上报设备信息
|
* 上报设备信息
|
||||||
|
*
|
||||||
* @param device 设备
|
* @param device 设备
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -868,6 +923,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置设备状态
|
* 重置设备状态
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -878,6 +934,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备
|
* 删除设备
|
||||||
|
*
|
||||||
* @param deviceId 需要删除的设备主键
|
* @param deviceId 需要删除的设备主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@@ -229,6 +229,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where serial_number = #{serialNumber}
|
where serial_number = #{serialNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeviceCountBySerialNumber" parameterType="String" resultType="int">
|
||||||
|
select count(device_id) from iot_device
|
||||||
|
where serial_number = #{serialNumber}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceProductAlertCount" parameterType="com.ruoyi.iot.domain.Device" resultType="com.ruoyi.iot.model.DeviceStatistic">
|
<select id="selectDeviceProductAlertCount" parameterType="com.ruoyi.iot.domain.Device" resultType="com.ruoyi.iot.model.DeviceStatistic">
|
||||||
select
|
select
|
||||||
<!--设备数量-->
|
<!--设备数量-->
|
||||||
|
Reference in New Issue
Block a user