mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
后端功能完善
This commit is contained in:
@@ -113,9 +113,9 @@ public class SwaggerConfig
|
|||||||
// 用ApiInfoBuilder进行定制
|
// 用ApiInfoBuilder进行定制
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
// 设置标题
|
// 设置标题
|
||||||
.title("标题:若依管理系统_接口文档")
|
.title("标题:物美智能设备_接口文档")
|
||||||
// 描述
|
// 描述
|
||||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
.description("描述:物联网模块接口")
|
||||||
// 作者信息
|
// 作者信息
|
||||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||||
// 版本
|
// 版本
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -26,6 +29,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2021-05-07
|
* @date 2021-05-07
|
||||||
*/
|
*/
|
||||||
|
@Api(value="设备分类",tags="设备分类")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/category")
|
@RequestMapping("/system/category")
|
||||||
public class IotCategoryController extends BaseController
|
public class IotCategoryController extends BaseController
|
||||||
@@ -36,6 +40,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询设备分类列表
|
* 查询设备分类列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "分类列表", notes = "分类列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:list')")
|
@PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(IotCategory iotCategory)
|
public TableDataInfo list(IotCategory iotCategory)
|
||||||
@@ -48,6 +53,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出设备分类列表
|
* 导出设备分类列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "导出分类列表", notes = "导出分类列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:export')")
|
@PreAuthorize("@ss.hasPermi('system:category:export')")
|
||||||
@Log(title = "设备分类", businessType = BusinessType.EXPORT)
|
@Log(title = "设备分类", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
@@ -61,6 +67,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取设备分类详细信息
|
* 获取设备分类详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取分类详情", notes = "获取分类详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:query')")
|
@PreAuthorize("@ss.hasPermi('system:category:query')")
|
||||||
@GetMapping(value = "/{categoryId}")
|
@GetMapping(value = "/{categoryId}")
|
||||||
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
|
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
|
||||||
@@ -71,6 +78,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增设备分类
|
* 新增设备分类
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "新增分类", notes = "新增分类")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:add')")
|
@PreAuthorize("@ss.hasPermi('system:category:add')")
|
||||||
@Log(title = "设备分类", businessType = BusinessType.INSERT)
|
@Log(title = "设备分类", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@@ -82,6 +90,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改设备分类
|
* 修改设备分类
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "修改分类", notes = "修改分类")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:edit')")
|
@PreAuthorize("@ss.hasPermi('system:category:edit')")
|
||||||
@Log(title = "设备分类", businessType = BusinessType.UPDATE)
|
@Log(title = "设备分类", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@@ -93,6 +102,7 @@ public class IotCategoryController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除设备分类
|
* 删除设备分类
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "删除分类", notes = "删除分类")
|
||||||
@PreAuthorize("@ss.hasPermi('system:category:remove')")
|
@PreAuthorize("@ss.hasPermi('system:category:remove')")
|
||||||
@Log(title = "设备分类", businessType = BusinessType.DELETE)
|
@Log(title = "设备分类", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{categoryIds}")
|
@DeleteMapping("/{categoryIds}")
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.vo.IotDeviceListDto;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -26,6 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2021-05-06
|
* @date 2021-05-06
|
||||||
*/
|
*/
|
||||||
|
@Api(value="设备",tags="设备")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/device")
|
@RequestMapping("/system/device")
|
||||||
public class IotDeviceController extends BaseController
|
public class IotDeviceController extends BaseController
|
||||||
@@ -36,31 +41,34 @@ public class IotDeviceController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "设备列表", notes = "设备列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:list')")
|
@PreAuthorize("@ss.hasPermi('system:device:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(IotDevice iotDevice)
|
public TableDataInfo list(IotDevice iotDevice)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<IotDevice> list = iotDeviceService.selectIotDeviceList(iotDevice);
|
List<IotDeviceListDto> list = iotDeviceService.selectIotDeviceList(iotDevice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出设备列表
|
* 导出设备列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "导出设备列表", notes = "导出设备列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:export')")
|
@PreAuthorize("@ss.hasPermi('system:device:export')")
|
||||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult export(IotDevice iotDevice)
|
public AjaxResult export(IotDevice iotDevice)
|
||||||
{
|
{
|
||||||
List<IotDevice> list = iotDeviceService.selectIotDeviceList(iotDevice);
|
List<IotDeviceListDto> list = iotDeviceService.selectIotDeviceList(iotDevice);
|
||||||
ExcelUtil<IotDevice> util = new ExcelUtil<IotDevice>(IotDevice.class);
|
ExcelUtil<IotDeviceListDto> util = new ExcelUtil<IotDeviceListDto>(IotDeviceListDto.class);
|
||||||
return util.exportExcel(list, "device");
|
return util.exportExcel(list, "device");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备详细信息
|
* 获取设备详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取设备详情", notes = "获取设备详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:query')")
|
@PreAuthorize("@ss.hasPermi('system:device:query')")
|
||||||
@GetMapping(value = "/{deviceId}")
|
@GetMapping(value = "/{deviceId}")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
||||||
@@ -68,9 +76,21 @@ public class IotDeviceController extends BaseController
|
|||||||
return AjaxResult.success(iotDeviceService.selectIotDeviceById(deviceId));
|
return AjaxResult.success(iotDeviceService.selectIotDeviceById(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号获取设备详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据设备编号获取设备详情", notes = "根据设备编号获取设备详情")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:device:query')")
|
||||||
|
@GetMapping(value = "/getByNum/{deviceNum}")
|
||||||
|
public AjaxResult getInfoByNum(@PathVariable("deviceNum") String deviceNum)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(iotDeviceService.selectIotDeviceByNum(deviceNum));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "新增设备", notes = "新增设备")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:add')")
|
@PreAuthorize("@ss.hasPermi('system:device:add')")
|
||||||
@Log(title = "设备", businessType = BusinessType.INSERT)
|
@Log(title = "设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@@ -82,6 +102,7 @@ public class IotDeviceController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改设备
|
* 修改设备
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "修改设备", notes = "修改设备")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:edit')")
|
@PreAuthorize("@ss.hasPermi('system:device:edit')")
|
||||||
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@@ -93,6 +114,7 @@ public class IotDeviceController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除设备
|
* 删除设备
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "删除设备", notes = "删除设备")
|
||||||
@PreAuthorize("@ss.hasPermi('system:device:remove')")
|
@PreAuthorize("@ss.hasPermi('system:device:remove')")
|
||||||
@Log(title = "设备", businessType = BusinessType.DELETE)
|
@Log(title = "设备", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceIds}")
|
@DeleteMapping("/{deviceIds}")
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.system.mqtt.config.MqttPushClient;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -26,6 +31,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2021-05-06
|
* @date 2021-05-06
|
||||||
*/
|
*/
|
||||||
|
@Api(value="设备配置",tags="设备配置")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/set")
|
@RequestMapping("/system/set")
|
||||||
public class IotDeviceSetController extends BaseController
|
public class IotDeviceSetController extends BaseController
|
||||||
@@ -33,9 +39,13 @@ public class IotDeviceSetController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IIotDeviceSetService iotDeviceSetService;
|
private IIotDeviceSetService iotDeviceSetService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MqttPushClient mqttPushClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备配置列表
|
* 查询设备配置列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "查询设备配置列表", notes = "查询设备配置列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:list')")
|
@PreAuthorize("@ss.hasPermi('system:set:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(IotDeviceSet iotDeviceSet)
|
public TableDataInfo list(IotDeviceSet iotDeviceSet)
|
||||||
@@ -48,6 +58,7 @@ public class IotDeviceSetController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出设备配置列表
|
* 导出设备配置列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "导出设备配置列表", notes = "导出设备配置列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:export')")
|
@PreAuthorize("@ss.hasPermi('system:set:export')")
|
||||||
@Log(title = "设备配置", businessType = BusinessType.EXPORT)
|
@Log(title = "设备配置", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
@@ -61,6 +72,7 @@ public class IotDeviceSetController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取设备配置详细信息
|
* 获取设备配置详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取设备配置详情", notes = "获取设备配置详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:query')")
|
@PreAuthorize("@ss.hasPermi('system:set:query')")
|
||||||
@GetMapping(value = "/{deviceSetId}")
|
@GetMapping(value = "/{deviceSetId}")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceSetId") Long deviceSetId)
|
public AjaxResult getInfo(@PathVariable("deviceSetId") Long deviceSetId)
|
||||||
@@ -71,6 +83,7 @@ public class IotDeviceSetController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取最新设备配置详细信息
|
* 获取最新设备配置详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取最新设备配置详情", notes = "获取最新设备配置详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:query')")
|
@PreAuthorize("@ss.hasPermi('system:set:query')")
|
||||||
@GetMapping(value = "/new/{deviceId}")
|
@GetMapping(value = "/new/{deviceId}")
|
||||||
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
|
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
|
||||||
@@ -81,6 +94,7 @@ public class IotDeviceSetController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增设备配置
|
* 新增设备配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "新增设备配置", notes = "新增设备配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:add')")
|
@PreAuthorize("@ss.hasPermi('system:set:add')")
|
||||||
@Log(title = "设备配置", businessType = BusinessType.INSERT)
|
@Log(title = "设备配置", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@@ -92,22 +106,38 @@ public class IotDeviceSetController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改设备配置
|
* 修改设备配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "修改设备配置", notes = "修改设备配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:edit')")
|
@PreAuthorize("@ss.hasPermi('system:set:edit')")
|
||||||
@Log(title = "设备配置", businessType = BusinessType.UPDATE)
|
@Log(title = "设备配置", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody IotDeviceSet iotDeviceSet)
|
public AjaxResult edit(@RequestBody IotDeviceSet iotDeviceSet)
|
||||||
{
|
{
|
||||||
return toAjax(iotDeviceSetService.updateIotDeviceSet(iotDeviceSet));
|
// 存储
|
||||||
|
iotDeviceSetService.updateIotDeviceSet(iotDeviceSet);
|
||||||
|
// mqtt发布
|
||||||
|
String content = JSON.toJSONString(iotDeviceSet);
|
||||||
|
boolean isSuccess=mqttPushClient.publish(0,true,"setting/set/"+iotDeviceSet.getDeviceNum(),content);
|
||||||
|
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
|
||||||
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "mqtt获取设备配置", notes = "mqtt获取设备配置")
|
||||||
|
@GetMapping(value = "/getSetting/{deviceNum}")
|
||||||
|
public AjaxResult getSetting(@PathVariable("deviceNum") String deviceNum){
|
||||||
|
boolean isSuccess=mqttPushClient.publish(0,true,"setting/get/"+deviceNum,"wumei.live");
|
||||||
|
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
|
||||||
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备配置
|
* 删除设备配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "删除设备配置", notes = "删除设备配置")
|
||||||
@PreAuthorize("@ss.hasPermi('system:set:remove')")
|
@PreAuthorize("@ss.hasPermi('system:set:remove')")
|
||||||
@Log(title = "设备配置", businessType = BusinessType.DELETE)
|
@Log(title = "设备配置", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceConfigIds}")
|
@DeleteMapping("/{deviceSetIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] deviceConfigIds)
|
public AjaxResult remove(@PathVariable Long[] deviceSetIds)
|
||||||
{
|
{
|
||||||
return toAjax(iotDeviceSetService.deleteIotDeviceSetByIds(deviceConfigIds));
|
return toAjax(iotDeviceSetService.deleteIotDeviceSetByIds(deviceSetIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.system.mqtt.config.MqttPushClient;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -26,6 +31,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2021-05-06
|
* @date 2021-05-06
|
||||||
*/
|
*/
|
||||||
|
@Api(value="设备状态",tags="设备状态")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/status")
|
@RequestMapping("/system/status")
|
||||||
public class IotDeviceStatusController extends BaseController
|
public class IotDeviceStatusController extends BaseController
|
||||||
@@ -33,9 +39,13 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IIotDeviceStatusService iotDeviceStatusService;
|
private IIotDeviceStatusService iotDeviceStatusService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MqttPushClient mqttPushClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备状态列表
|
* 查询设备状态列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "查询设备状态列表", notes = "查询设备状态列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:list')")
|
@PreAuthorize("@ss.hasPermi('system:status:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(IotDeviceStatus iotDeviceStatus)
|
public TableDataInfo list(IotDeviceStatus iotDeviceStatus)
|
||||||
@@ -48,6 +58,7 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出设备状态列表
|
* 导出设备状态列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "导出设备状态列表", notes = "导出设备状态列表")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:export')")
|
@PreAuthorize("@ss.hasPermi('system:status:export')")
|
||||||
@Log(title = "设备状态", businessType = BusinessType.EXPORT)
|
@Log(title = "设备状态", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
@@ -61,6 +72,7 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取设备状态详细信息
|
* 获取设备状态详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取设备状态详情", notes = "获取设备状态详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:query')")
|
@PreAuthorize("@ss.hasPermi('system:status:query')")
|
||||||
@GetMapping(value = "/{deviceStatusId}")
|
@GetMapping(value = "/{deviceStatusId}")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceStatusId") Long deviceStatusId)
|
public AjaxResult getInfo(@PathVariable("deviceStatusId") Long deviceStatusId)
|
||||||
@@ -68,9 +80,21 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
return AjaxResult.success(iotDeviceStatusService.selectIotDeviceStatusById(deviceStatusId));
|
return AjaxResult.success(iotDeviceStatusService.selectIotDeviceStatusById(deviceStatusId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号获取设备状态
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据设备编号获取最新设备状态", notes = "根据设备编号获取最新设备状态")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:status:query')")
|
||||||
|
@GetMapping(value = "/newByNum/{deviceNum}")
|
||||||
|
public AjaxResult getNewStatus(@PathVariable("deviceNum") String deviceNum)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(iotDeviceStatusService.selectIotDeviceStatusByDeviceNum(deviceNum));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最新设备状态详细信息
|
* 获取最新设备状态详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "获取最新设备状态详情", notes = "获取最新设备状态详情")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:query')")
|
@PreAuthorize("@ss.hasPermi('system:status:query')")
|
||||||
@GetMapping(value = "/new/{deviceId}")
|
@GetMapping(value = "/new/{deviceId}")
|
||||||
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
|
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
|
||||||
@@ -81,6 +105,7 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增设备状态
|
* 新增设备状态
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "新增设备状态", notes = "新增设备状态")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:add')")
|
@PreAuthorize("@ss.hasPermi('system:status:add')")
|
||||||
@Log(title = "设备状态", businessType = BusinessType.INSERT)
|
@Log(title = "设备状态", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@@ -92,17 +117,33 @@ public class IotDeviceStatusController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改设备状态
|
* 修改设备状态
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "修改设备状态", notes = "修改设备状态")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:edit')")
|
@PreAuthorize("@ss.hasPermi('system:status:edit')")
|
||||||
@Log(title = "设备状态", businessType = BusinessType.UPDATE)
|
@Log(title = "设备状态", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody IotDeviceStatus iotDeviceStatus)
|
public AjaxResult edit(@RequestBody IotDeviceStatus iotDeviceStatus)
|
||||||
{
|
{
|
||||||
return toAjax(iotDeviceStatusService.updateIotDeviceStatus(iotDeviceStatus));
|
// 存储
|
||||||
|
iotDeviceStatusService.updateIotDeviceStatus(iotDeviceStatus);
|
||||||
|
// mqtt发布
|
||||||
|
String content = JSON.toJSONString(iotDeviceStatus);
|
||||||
|
boolean isSuccess=mqttPushClient.publish(1,true,"status/set/"+iotDeviceStatus.getDeviceNum(),content);
|
||||||
|
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
|
||||||
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "mqtt获取设备状态", notes = "mqtt获取设备状态")
|
||||||
|
@GetMapping(value = "/getStatus/{deviceNum}")
|
||||||
|
public AjaxResult getStatus(@PathVariable("deviceNum") String deviceNum){
|
||||||
|
boolean isSuccess=mqttPushClient.publish(0,true,"status/get/"+deviceNum,"wumei.live");
|
||||||
|
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
|
||||||
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备状态
|
* 删除设备状态
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation(value = "删除设备状态", notes = "删除设备状态")
|
||||||
@PreAuthorize("@ss.hasPermi('system:status:remove')")
|
@PreAuthorize("@ss.hasPermi('system:status:remove')")
|
||||||
@Log(title = "设备状态", businessType = BusinessType.DELETE)
|
@Log(title = "设备状态", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceStatusIds}")
|
@DeleteMapping("/{deviceStatusIds}")
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.IotGroup;
|
||||||
|
import com.ruoyi.system.service.IIotGroupService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组Controller
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-18
|
||||||
|
*/
|
||||||
|
@Api(value="设备分组",tags="设备分组")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/group")
|
||||||
|
public class IotGroupController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IIotGroupService iotGroupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分组列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "分组列表", notes = "分组列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<IotGroup> list = iotGroupService.selectIotGroupList(iotGroup);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出分组列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出分组", notes = "导出分组")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:export')")
|
||||||
|
@Log(title = "分组", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
List<IotGroup> list = iotGroupService.selectIotGroupList(iotGroup);
|
||||||
|
ExcelUtil<IotGroup> util = new ExcelUtil<IotGroup>(IotGroup.class);
|
||||||
|
return util.exportExcel(list, "group");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分组详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取分组详情", notes = "获取分组详情")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:query')")
|
||||||
|
@GetMapping(value = "/{groupId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(iotGroupService.selectIotGroupById(groupId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分组
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增分组", notes = "新增分组")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:add')")
|
||||||
|
@Log(title = "分组", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
return toAjax(iotGroupService.insertIotGroup(iotGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分组
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改分组", notes = "修改分组")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:edit')")
|
||||||
|
@Log(title = "分组", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
return toAjax(iotGroupService.updateIotGroup(iotGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分组
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除分组", notes = "删除分组")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:group:remove')")
|
||||||
|
@Log(title = "分组", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{groupIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] groupIds)
|
||||||
|
{
|
||||||
|
return toAjax(iotGroupService.deleteIotGroupByIds(groupIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,12 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 用户测试方法
|
* mqtt接口
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Api("mqtt测试")
|
@Api(value="mqtt消息发布",tags="mqtt消息发布")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test/mqtt")
|
@RequestMapping("/system/mqtt")
|
||||||
public class MqttController extends BaseController
|
public class MqttController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -29,7 +29,7 @@ public class MqttController extends BaseController
|
|||||||
@PostMapping(value = "/updateStatus")
|
@PostMapping(value = "/updateStatus")
|
||||||
public AjaxResult updateStatus(@RequestBody IotDeviceStatus iotDeviceStatus){
|
public AjaxResult updateStatus(@RequestBody IotDeviceStatus iotDeviceStatus){
|
||||||
String content = JSON.toJSONString(iotDeviceStatus);
|
String content = JSON.toJSONString(iotDeviceStatus);
|
||||||
boolean isSuccess=mqttPushClient.publish(1,false,"status/"+iotDeviceStatus.getDeviceNum(),content);
|
boolean isSuccess=mqttPushClient.publish(1,false,"status/set/"+iotDeviceStatus.getDeviceNum(),content);
|
||||||
if(isSuccess){return AjaxResult.success();}
|
if(isSuccess){return AjaxResult.success();}
|
||||||
return AjaxResult.error("mqtt 发布失败。");
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ public class MqttController extends BaseController
|
|||||||
@ApiOperation(value = "获取设备状态", notes = "获取设备状态")
|
@ApiOperation(value = "获取设备状态", notes = "获取设备状态")
|
||||||
@GetMapping(value = "/getStatus/{deviceNum}")
|
@GetMapping(value = "/getStatus/{deviceNum}")
|
||||||
public AjaxResult getStatus(@PathVariable("deviceNum") String deviceNum){
|
public AjaxResult getStatus(@PathVariable("deviceNum") String deviceNum){
|
||||||
boolean isSuccess=mqttPushClient.publish(0,false,"status/new/"+deviceNum,"");
|
boolean isSuccess=mqttPushClient.publish(0,false,"status/get/"+deviceNum,"wumei.live");
|
||||||
if(isSuccess){return AjaxResult.success();}
|
if(isSuccess){return AjaxResult.success();}
|
||||||
return AjaxResult.error("mqtt 发布失败。");
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ public class MqttController extends BaseController
|
|||||||
@PostMapping(value = "/updateSetting")
|
@PostMapping(value = "/updateSetting")
|
||||||
public AjaxResult updateSetting(@RequestBody IotDeviceSet iotDeviceSet){
|
public AjaxResult updateSetting(@RequestBody IotDeviceSet iotDeviceSet){
|
||||||
String content = JSON.toJSONString(iotDeviceSet);
|
String content = JSON.toJSONString(iotDeviceSet);
|
||||||
boolean isSuccess=mqttPushClient.publish(0,false,"setting/"+iotDeviceSet.getDeviceNum(),content);
|
boolean isSuccess=mqttPushClient.publish(0,false,"setting/set/"+iotDeviceSet.getDeviceNum(),content);
|
||||||
if(isSuccess){return AjaxResult.success();}
|
if(isSuccess){return AjaxResult.success();}
|
||||||
return AjaxResult.error("mqtt 发布失败。");
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public class MqttController extends BaseController
|
|||||||
@ApiOperation(value = "获取设备配置", notes = "获取设备配置")
|
@ApiOperation(value = "获取设备配置", notes = "获取设备配置")
|
||||||
@GetMapping(value = "/getSetting/{deviceNum}")
|
@GetMapping(value = "/getSetting/{deviceNum}")
|
||||||
public AjaxResult getSetting(@PathVariable("deviceNum") String deviceNum){
|
public AjaxResult getSetting(@PathVariable("deviceNum") String deviceNum){
|
||||||
boolean isSuccess=mqttPushClient.publish(0,false,"Setting/new/"+deviceNum,"");
|
boolean isSuccess=mqttPushClient.publish(0,false,"setting/get/"+deviceNum,"wumei.lie");
|
||||||
if(isSuccess){return AjaxResult.success();}
|
if(isSuccess){return AjaxResult.success();}
|
||||||
return AjaxResult.error("mqtt 发布失败。");
|
return AjaxResult.error("mqtt 发布失败。");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,18 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
@Excel(name = "打开AP")
|
@Excel(name = "打开AP")
|
||||||
private Integer isAp;
|
private Integer isAp;
|
||||||
|
|
||||||
|
/** 是否离线使用 */
|
||||||
|
@Excel(name = "是否离线使用")
|
||||||
|
private Integer isWifiOffline;
|
||||||
|
|
||||||
|
/** 是否使用证书 */
|
||||||
|
@Excel(name = "是否使用证书")
|
||||||
|
private Integer isOpenCertifi;
|
||||||
|
|
||||||
|
/** 智能配网 */
|
||||||
|
@Excel(name = "智能配网")
|
||||||
|
private Integer isSmartConfig;
|
||||||
|
|
||||||
/** 射频遥控 */
|
/** 射频遥控 */
|
||||||
@Excel(name = "射频遥控")
|
@Excel(name = "射频遥控")
|
||||||
private Integer isRfControl;
|
private Integer isRfControl;
|
||||||
@@ -86,6 +98,10 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
@Excel(name = "配网IP")
|
@Excel(name = "配网IP")
|
||||||
private String networkIp;
|
private String networkIp;
|
||||||
|
|
||||||
|
/** 雷达感应间隔 */
|
||||||
|
@Excel(name = "雷达感应间隔")
|
||||||
|
private Integer radarInterval;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
@@ -152,15 +168,43 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
{
|
{
|
||||||
return isReset;
|
return isReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAp(Integer isAp)
|
public void setIsAp(Integer isAp)
|
||||||
{
|
{
|
||||||
this.isAp = isAp;
|
this.isAp = isAp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getIsAp()
|
public Integer getIsAp()
|
||||||
{
|
{
|
||||||
return isAp;
|
return isAp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsWifiOffline(Integer isWifiOffline)
|
||||||
|
{
|
||||||
|
this.isWifiOffline = isWifiOffline;
|
||||||
|
}
|
||||||
|
public Integer getIsWifiOffline()
|
||||||
|
{
|
||||||
|
return isWifiOffline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsOpenCertifi(Integer isOpenCertifi)
|
||||||
|
{
|
||||||
|
this.isOpenCertifi = isOpenCertifi;
|
||||||
|
}
|
||||||
|
public Integer getIsOpenCertifi()
|
||||||
|
{
|
||||||
|
return isOpenCertifi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSmartConfig(Integer isSmartConfig)
|
||||||
|
{
|
||||||
|
this.isSmartConfig = isSmartConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSmartConfig()
|
||||||
|
{
|
||||||
|
return isSmartConfig;
|
||||||
|
}
|
||||||
public void setIsRfControl(Integer isRfControl)
|
public void setIsRfControl(Integer isRfControl)
|
||||||
{
|
{
|
||||||
this.isRfControl = isRfControl;
|
this.isRfControl = isRfControl;
|
||||||
@@ -256,6 +300,16 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRadarInterval(Integer radarInterval)
|
||||||
|
{
|
||||||
|
this.radarInterval = radarInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRadarInterval()
|
||||||
|
{
|
||||||
|
return radarInterval;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDelFlag()
|
public String getDelFlag()
|
||||||
{
|
{
|
||||||
return delFlag;
|
return delFlag;
|
||||||
@@ -272,6 +326,7 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
.append("isHost", getIsHost())
|
.append("isHost", getIsHost())
|
||||||
.append("isReset", getIsReset())
|
.append("isReset", getIsReset())
|
||||||
.append("isAp", getIsAp())
|
.append("isAp", getIsAp())
|
||||||
|
.append("isSmartConfig", getIsSmartConfig())
|
||||||
.append("isRfControl", getIsRfControl())
|
.append("isRfControl", getIsRfControl())
|
||||||
.append("isRfLearn", getIsRfLearn())
|
.append("isRfLearn", getIsRfLearn())
|
||||||
.append("isRfClear", getIsRfClear())
|
.append("isRfClear", getIsRfClear())
|
||||||
@@ -282,6 +337,7 @@ public class IotDeviceSet extends BaseEntity
|
|||||||
.append("ownerId", getOwnerId())
|
.append("ownerId", getOwnerId())
|
||||||
.append("networkAddress", getNetworkAddress())
|
.append("networkAddress", getNetworkAddress())
|
||||||
.append("networkIp", getNetworkIp())
|
.append("networkIp", getNetworkIp())
|
||||||
|
.append("radarInterval", getRadarInterval())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ public class IotDeviceStatus extends BaseEntity
|
|||||||
private BigDecimal deviceTemperature;
|
private BigDecimal deviceTemperature;
|
||||||
|
|
||||||
/** 设备湿度 */
|
/** 设备湿度 */
|
||||||
@Excel(name = "设备湿度")
|
@Excel(name = "信号")
|
||||||
private BigDecimal deviceHumidity;
|
private Integer rssi;
|
||||||
|
|
||||||
/** 空气温度 */
|
/** 空气温度 */
|
||||||
@Excel(name = "空气温度")
|
@Excel(name = "空气温度")
|
||||||
@@ -71,6 +71,10 @@ public class IotDeviceStatus extends BaseEntity
|
|||||||
@Excel(name = "彩灯模式")
|
@Excel(name = "彩灯模式")
|
||||||
private Integer lightMode;
|
private Integer lightMode;
|
||||||
|
|
||||||
|
/** 灯渐变时间 */
|
||||||
|
@Excel(name = "渐变时间")
|
||||||
|
private Integer fadeTime;
|
||||||
|
|
||||||
/** 红灯 */
|
/** 红灯 */
|
||||||
@Excel(name = "红灯")
|
@Excel(name = "红灯")
|
||||||
private Long red;
|
private Long red;
|
||||||
@@ -149,14 +153,14 @@ public class IotDeviceStatus extends BaseEntity
|
|||||||
{
|
{
|
||||||
return deviceTemperature;
|
return deviceTemperature;
|
||||||
}
|
}
|
||||||
public void setDeviceHumidity(BigDecimal deviceHumidity)
|
public void setRssi(Integer rssi)
|
||||||
{
|
{
|
||||||
this.deviceHumidity = deviceHumidity;
|
this.rssi = rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getDeviceHumidity()
|
public Integer getRssi()
|
||||||
{
|
{
|
||||||
return deviceHumidity;
|
return rssi;
|
||||||
}
|
}
|
||||||
public void setAirTemperature(BigDecimal airTemperature)
|
public void setAirTemperature(BigDecimal airTemperature)
|
||||||
{
|
{
|
||||||
@@ -244,6 +248,15 @@ public class IotDeviceStatus extends BaseEntity
|
|||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFadeTime(Integer fadeTime)
|
||||||
|
{
|
||||||
|
this.fadeTime = fadeTime;
|
||||||
|
}
|
||||||
|
public Integer getFadeTime()
|
||||||
|
{
|
||||||
|
return fadeTime;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDelFlag()
|
public String getDelFlag()
|
||||||
{
|
{
|
||||||
return delFlag;
|
return delFlag;
|
||||||
@@ -259,13 +272,14 @@ public class IotDeviceStatus extends BaseEntity
|
|||||||
.append("lightStatus", getLightStatus())
|
.append("lightStatus", getLightStatus())
|
||||||
.append("isOnline", getIsOnline())
|
.append("isOnline", getIsOnline())
|
||||||
.append("deviceTemperature", getDeviceTemperature())
|
.append("deviceTemperature", getDeviceTemperature())
|
||||||
.append("deviceHumidity", getDeviceHumidity())
|
.append("rssid", getRssi())
|
||||||
.append("airTemperature", getAirTemperature())
|
.append("airTemperature", getAirTemperature())
|
||||||
.append("airHumidity", getAirHumidity())
|
.append("airHumidity", getAirHumidity())
|
||||||
.append("triggerSource", getTriggerSource())
|
.append("triggerSource", getTriggerSource())
|
||||||
.append("brightness", getBrightness())
|
.append("brightness", getBrightness())
|
||||||
.append("lightInterval", getLightInterval())
|
.append("lightInterval", getLightInterval())
|
||||||
.append("lightMode", getLightMode())
|
.append("lightMode", getLightMode())
|
||||||
|
.append("fadeTime", getFadeTime())
|
||||||
.append("red", getRed())
|
.append("red", getRed())
|
||||||
.append("green", getGreen())
|
.append("green", getGreen())
|
||||||
.append("blue", getBlue())
|
.append("blue", getBlue())
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组对象 iot_group
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-18
|
||||||
|
*/
|
||||||
|
public class IotGroup extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 设备分组 */
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
/** 用户 */
|
||||||
|
@Excel(name = "用户")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 分组名称 */
|
||||||
|
@Excel(name = "分组名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
@Excel(name = "排序")
|
||||||
|
private Integer groupOrder;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
public void setGroupId(Long groupId)
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGroupId()
|
||||||
|
{
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
public void setUserId(Long userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
public void setGroupName(String groupName)
|
||||||
|
{
|
||||||
|
this.groupName = groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupName()
|
||||||
|
{
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
public void setGroupOrder(Integer groupOrder)
|
||||||
|
{
|
||||||
|
this.groupOrder = groupOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGroupOrder()
|
||||||
|
{
|
||||||
|
return groupOrder;
|
||||||
|
}
|
||||||
|
public void setDelFlag(String delFlag)
|
||||||
|
{
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDelFlag()
|
||||||
|
{
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("groupId", getGroupId())
|
||||||
|
.append("userId", getUserId())
|
||||||
|
.append("groupName", getGroupName())
|
||||||
|
.append("groupOrder", getGroupOrder())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备对象 iot_device
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-06
|
||||||
|
*/
|
||||||
|
public class IotDeviceListDto extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 序号 */
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/** 编号 */
|
||||||
|
@Excel(name = "编号")
|
||||||
|
private String deviceNum;
|
||||||
|
|
||||||
|
/** 分类 */
|
||||||
|
@Excel(name = "分类")
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
/** 名称 */
|
||||||
|
@Excel(name = "名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/** 固件版本 */
|
||||||
|
@Excel(name = "固件版本")
|
||||||
|
private String firmwareVersion;
|
||||||
|
|
||||||
|
/** 用户 */
|
||||||
|
@Excel(name = "用户")
|
||||||
|
private String ownerId;
|
||||||
|
|
||||||
|
@Excel(name="用户昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
|
||||||
|
/** 报警 */
|
||||||
|
@Excel(name = "报警")
|
||||||
|
private Integer isAlarm;
|
||||||
|
|
||||||
|
/** 雷达感应 */
|
||||||
|
@Excel(name = "雷达感应")
|
||||||
|
private Integer isRadar;
|
||||||
|
|
||||||
|
/** 射频遥控 */
|
||||||
|
@Excel(name = "射频遥控")
|
||||||
|
private Integer isRfControl;
|
||||||
|
|
||||||
|
/** 配网地址 */
|
||||||
|
@Excel(name = "配网地址")
|
||||||
|
private String networkAddress;
|
||||||
|
|
||||||
|
/** 配网IP */
|
||||||
|
@Excel(name = "配网IP")
|
||||||
|
private String networkIp;
|
||||||
|
|
||||||
|
|
||||||
|
/** 继电器 */
|
||||||
|
@Excel(name = "继电器")
|
||||||
|
private Integer relayStatus;
|
||||||
|
|
||||||
|
/** 灯状态 */
|
||||||
|
@Excel(name = "灯状态")
|
||||||
|
private Integer lightStatus;
|
||||||
|
|
||||||
|
/** 在线 */
|
||||||
|
@Excel(name = "在线")
|
||||||
|
private Integer isOnline;
|
||||||
|
|
||||||
|
/** 设备温度 */
|
||||||
|
@Excel(name = "设备温度")
|
||||||
|
private BigDecimal deviceTemperature;
|
||||||
|
|
||||||
|
/** 设备湿度 */
|
||||||
|
@Excel(name = "信号")
|
||||||
|
private Integer rssi;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setDeviceId(Long deviceId)
|
||||||
|
{
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
public Long getDeviceId()
|
||||||
|
{
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
public void setDeviceNum(String deviceNum)
|
||||||
|
{
|
||||||
|
this.deviceNum = deviceNum;
|
||||||
|
}
|
||||||
|
public String getDeviceNum()
|
||||||
|
{
|
||||||
|
return deviceNum;
|
||||||
|
}
|
||||||
|
public void setCategoryId(Long categoryId)
|
||||||
|
{
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
}
|
||||||
|
public Long getCategoryId()
|
||||||
|
{
|
||||||
|
return categoryId;
|
||||||
|
}
|
||||||
|
public void setDeviceName(String deviceName)
|
||||||
|
{
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
}
|
||||||
|
public String getDeviceName()
|
||||||
|
{
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
public void setFirmwareVersion(String firmwareVersion)
|
||||||
|
{
|
||||||
|
this.firmwareVersion = firmwareVersion;
|
||||||
|
}
|
||||||
|
public String getFirmwareVersion()
|
||||||
|
{
|
||||||
|
return firmwareVersion;
|
||||||
|
}
|
||||||
|
public void setOwnerId(String ownerId)
|
||||||
|
{
|
||||||
|
this.ownerId = ownerId;
|
||||||
|
}
|
||||||
|
public String getOwnerId()
|
||||||
|
{
|
||||||
|
return ownerId;
|
||||||
|
}
|
||||||
|
public void setNickName(String nickName)
|
||||||
|
{
|
||||||
|
this.nickName = nickName;
|
||||||
|
}
|
||||||
|
public String getNickName()
|
||||||
|
{
|
||||||
|
return nickName;
|
||||||
|
}
|
||||||
|
public void setDelFlag(String delFlag)
|
||||||
|
{
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
public String getDelFlag()
|
||||||
|
{
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsAlarm(Integer isAlarm)
|
||||||
|
{
|
||||||
|
this.isAlarm = isAlarm;
|
||||||
|
}
|
||||||
|
public Integer getIsAlarm()
|
||||||
|
{
|
||||||
|
return isAlarm;
|
||||||
|
}
|
||||||
|
public void setIsRadar(Integer isRadar)
|
||||||
|
{
|
||||||
|
this.isRadar = isRadar;
|
||||||
|
}
|
||||||
|
public Integer getIsRadar()
|
||||||
|
{
|
||||||
|
return isRadar;
|
||||||
|
}
|
||||||
|
public void setIsRfControl(Integer isRfControl)
|
||||||
|
{
|
||||||
|
this.isRfControl = isRfControl;
|
||||||
|
}
|
||||||
|
public Integer getIsRfControl()
|
||||||
|
{
|
||||||
|
return isRfControl;
|
||||||
|
}
|
||||||
|
public void setNetworkAddress(String networkAddress)
|
||||||
|
{
|
||||||
|
this.networkAddress = networkAddress;
|
||||||
|
}
|
||||||
|
public String getNetworkAddress()
|
||||||
|
{
|
||||||
|
return networkAddress;
|
||||||
|
}
|
||||||
|
public void setNetworkIp(String networkIp)
|
||||||
|
{
|
||||||
|
this.networkIp = networkIp;
|
||||||
|
}
|
||||||
|
public String getNetworkIp()
|
||||||
|
{
|
||||||
|
return networkIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelayStatus(Integer relayStatus)
|
||||||
|
{
|
||||||
|
this.relayStatus = relayStatus;
|
||||||
|
}
|
||||||
|
public Integer getRelayStatus()
|
||||||
|
{
|
||||||
|
return relayStatus;
|
||||||
|
}
|
||||||
|
public void setLightStatus(Integer lightStatus)
|
||||||
|
{
|
||||||
|
this.lightStatus = lightStatus;
|
||||||
|
}
|
||||||
|
public Integer getLightStatus()
|
||||||
|
{
|
||||||
|
return lightStatus;
|
||||||
|
}
|
||||||
|
public void setIsOnline(Integer isOnline)
|
||||||
|
{
|
||||||
|
this.isOnline = isOnline;
|
||||||
|
}
|
||||||
|
public Integer getIsOnline()
|
||||||
|
{
|
||||||
|
return isOnline;
|
||||||
|
}
|
||||||
|
public void setDeviceTemperature(BigDecimal deviceTemperature)
|
||||||
|
{
|
||||||
|
this.deviceTemperature = deviceTemperature;
|
||||||
|
}
|
||||||
|
public BigDecimal getDeviceTemperature()
|
||||||
|
{
|
||||||
|
return deviceTemperature;
|
||||||
|
}
|
||||||
|
public void setRssi(Integer rssi)
|
||||||
|
{
|
||||||
|
this.rssi = rssi;
|
||||||
|
}
|
||||||
|
public Integer getRssi()
|
||||||
|
{
|
||||||
|
return rssi;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.append("deviceNum", getDeviceNum())
|
||||||
|
.append("categoryId", getCategoryId())
|
||||||
|
.append("deviceName", getDeviceName())
|
||||||
|
.append("firmwareVersion", getFirmwareVersion())
|
||||||
|
.append("ownerId", getOwnerId())
|
||||||
|
.append("nickName", getNickName())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("isAlarm", getIsAlarm())
|
||||||
|
.append("isRadar", getIsRadar())
|
||||||
|
.append("isRfControl", getIsRfControl())
|
||||||
|
.append("networkAddress", getNetworkAddress())
|
||||||
|
.append("networkIp", getNetworkIp())
|
||||||
|
.append("relayStatus", getRelayStatus())
|
||||||
|
.append("lightStatus", getLightStatus())
|
||||||
|
.append("isOnline", getIsOnline())
|
||||||
|
.append("deviceTemperature", getDeviceTemperature())
|
||||||
|
.append("rssid", getRssi())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.system.domain.IotDevice;
|
import com.ruoyi.system.domain.IotDevice;
|
||||||
|
import com.ruoyi.system.domain.vo.IotDeviceListDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备Mapper接口
|
* 设备Mapper接口
|
||||||
@@ -19,13 +20,21 @@ public interface IotDeviceMapper
|
|||||||
*/
|
*/
|
||||||
public IotDevice selectIotDeviceById(Long deviceId);
|
public IotDevice selectIotDeviceById(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号查询设备
|
||||||
|
*
|
||||||
|
* @param deviceNum 设备编号
|
||||||
|
* @return 设备
|
||||||
|
*/
|
||||||
|
public IotDevice selectIotDeviceByNum(String deviceNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*
|
*
|
||||||
* @param iotDevice 设备
|
* @param iotDevice 设备
|
||||||
* @return 设备集合
|
* @return 设备集合
|
||||||
*/
|
*/
|
||||||
public List<IotDevice> selectIotDeviceList(IotDevice iotDevice);
|
public List<IotDeviceListDto> selectIotDeviceList(IotDevice iotDevice);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ public interface IotDeviceStatusMapper
|
|||||||
*/
|
*/
|
||||||
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId);
|
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号查询设备最新状态
|
||||||
|
*
|
||||||
|
* @param deviceNum 设备编号
|
||||||
|
* @return 设备状态
|
||||||
|
*/
|
||||||
|
public IotDeviceStatus selectIotDeviceStatusByDeviceNum(String deviceNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备状态列表
|
* 查询设备状态列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.IotGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组Mapper接口
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-18
|
||||||
|
*/
|
||||||
|
public interface IotGroupMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询分组
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 分组
|
||||||
|
*/
|
||||||
|
public IotGroup selectIotGroupById(Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分组列表
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 分组集合
|
||||||
|
*/
|
||||||
|
public List<IotGroup> selectIotGroupList(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertIotGroup(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateIotGroup(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分组
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteIotGroupById(Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除分组
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteIotGroupByIds(Long[] groupIds);
|
||||||
|
}
|
||||||
@@ -3,9 +3,14 @@ package com.ruoyi.system.mqtt.config;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
||||||
|
import com.ruoyi.common.utils.ip.IpUtils;
|
||||||
|
import com.ruoyi.system.domain.IotCategory;
|
||||||
import com.ruoyi.system.domain.IotDevice;
|
import com.ruoyi.system.domain.IotDevice;
|
||||||
import com.ruoyi.system.domain.IotDeviceSet;
|
import com.ruoyi.system.domain.IotDeviceSet;
|
||||||
import com.ruoyi.system.domain.IotDeviceStatus;
|
import com.ruoyi.system.domain.IotDeviceStatus;
|
||||||
|
import com.ruoyi.system.service.IIotCategoryService;
|
||||||
import com.ruoyi.system.service.IIotDeviceService;
|
import com.ruoyi.system.service.IIotDeviceService;
|
||||||
import com.ruoyi.system.service.IIotDeviceSetService;
|
import com.ruoyi.system.service.IIotDeviceSetService;
|
||||||
import com.ruoyi.system.service.IIotDeviceStatusService;
|
import com.ruoyi.system.service.IIotDeviceStatusService;
|
||||||
@@ -31,6 +36,8 @@ public class PushCallback implements MqttCallback {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IIotDeviceService iotDeviceService;
|
private IIotDeviceService iotDeviceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IIotCategoryService iotCategoryService;
|
||||||
|
@Autowired
|
||||||
private IIotDeviceStatusService iotDeviceStatusService;
|
private IIotDeviceStatusService iotDeviceStatusService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IIotDeviceSetService iotDeviceSetService;
|
private IIotDeviceSetService iotDeviceSetService;
|
||||||
@@ -58,33 +65,53 @@ public class PushCallback implements MqttCallback {
|
|||||||
if(topic.equals("device_info")){
|
if(topic.equals("device_info")){
|
||||||
//添加设备信息
|
//添加设备信息
|
||||||
IotDevice device = JSON.parseObject(new String(mqttMessage.getPayload()), IotDevice.class);
|
IotDevice device = JSON.parseObject(new String(mqttMessage.getPayload()), IotDevice.class);
|
||||||
iotDeviceService.insertIotDevice(device);
|
IotDevice deviceEntity=iotDeviceService.selectIotDeviceByNum(device.getDeviceNum());
|
||||||
//获取设备状态
|
if(deviceEntity!=null){
|
||||||
mqttPushClient.publish(0,false,"status/new/"+device.getDeviceNum(),"");
|
device.setDeviceId(deviceEntity.getDeviceId());
|
||||||
|
iotDeviceService.updateIotDevice(device);
|
||||||
|
}else {
|
||||||
|
IotCategory categoryEntity=iotCategoryService.selectIotCategoryById(device.getCategoryId());
|
||||||
|
if(device.getDeviceName()==null || device.getDeviceNum().length()==0) {
|
||||||
|
device.setDeviceName(categoryEntity.getCategoryName());
|
||||||
|
}
|
||||||
|
iotDeviceService.insertIotDevice(device);
|
||||||
|
}
|
||||||
|
//获取设备状态(消息内容不能为空,硬件获取不到数据报错)
|
||||||
|
mqttPushClient.publish(1,false,"status/get/"+device.getDeviceNum(),"wumei.live");
|
||||||
//获取设备配置
|
//获取设备配置
|
||||||
mqttPushClient.publish(0,false,"setting/new/"+device.getDeviceNum(),"");
|
mqttPushClient.publish(1,false,"setting/get/"+device.getDeviceNum(),"wumei.live");
|
||||||
}else if(topic.equals("status")){
|
}else if(topic.equals("status")){
|
||||||
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
|
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
|
||||||
IotDevice device=iotDeviceService.selectIotDeviceById(deviceStatus.getDeviceId());
|
IotDevice device=iotDeviceService.selectIotDeviceByNum(deviceStatus.getDeviceNum());
|
||||||
//添加设备状态
|
//添加设备状态
|
||||||
deviceStatus.setDeviceId(device.getDeviceId());
|
deviceStatus.setDeviceId(device.getDeviceId());
|
||||||
iotDeviceStatusService.insertIotDeviceStatus(deviceStatus);
|
iotDeviceStatusService.insertIotDeviceStatus(deviceStatus);
|
||||||
}else if(topic.equals("setting")){
|
}else if(topic.equals("setting")){
|
||||||
IotDeviceSet deviceSet = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceSet.class);
|
IotDeviceSet deviceSet = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceSet.class);
|
||||||
//更新设备用户
|
// 智能配网时需要获取IP、地址和设备用户
|
||||||
IotDevice device=iotDeviceService.selectIotDeviceById(deviceSet.getDeviceId());
|
IotDevice device=null;
|
||||||
device.setOwnerId(deviceSet.getOwnerId());
|
if(deviceSet.getIsSmartConfig()==1){
|
||||||
iotDeviceService.updateIotDevice(device);
|
final String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
||||||
|
deviceSet.setNetworkIp(ip);
|
||||||
|
deviceSet.setNetworkAddress( AddressUtils.getRealAddressByIP(ip));
|
||||||
|
//更新设备用户
|
||||||
|
device=iotDeviceService.selectIotDeviceByNum(deviceSet.getDeviceNum());
|
||||||
|
device.setOwnerId(deviceSet.getOwnerId());
|
||||||
|
iotDeviceService.updateIotDevice(device);
|
||||||
|
}
|
||||||
//添加设备配置
|
//添加设备配置
|
||||||
deviceSet.setDeviceId(device.getDeviceId());
|
deviceSet.setDeviceId(device.getDeviceId());
|
||||||
iotDeviceSetService.insertIotDeviceSet(deviceSet);
|
iotDeviceSetService.insertIotDeviceSet(deviceSet);
|
||||||
}else if(topic.equals("offline")){
|
}else if(topic.equals("offline")){
|
||||||
//离线遗嘱
|
//离线遗嘱 TODO:查询待优化
|
||||||
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
|
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
|
||||||
//添加设备状态
|
IotDevice device=iotDeviceService.selectIotDeviceByNum(deviceStatus.getDeviceNum());
|
||||||
IotDeviceStatus newDeviceStatus=iotDeviceStatusService.selectIotDeviceStatusById(deviceStatus.getDeviceStatusId());
|
IotDeviceStatus deviceStatusEntity=iotDeviceStatusService.selectIotDeviceStatusByDeviceId(device.getDeviceId());
|
||||||
newDeviceStatus.setIsOnline(0);
|
//跟新最近一条设备状态为离线
|
||||||
iotDeviceStatusService.insertIotDeviceStatus(newDeviceStatus);
|
if(deviceStatusEntity!=null) {
|
||||||
|
deviceStatusEntity.setIsOnline(0);
|
||||||
|
iotDeviceStatusService.updateIotDeviceStatus(deviceStatusEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.system.domain.IotDevice;
|
import com.ruoyi.system.domain.IotDevice;
|
||||||
|
import com.ruoyi.system.domain.vo.IotDeviceListDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备Service接口
|
* 设备Service接口
|
||||||
@@ -19,13 +20,18 @@ public interface IIotDeviceService
|
|||||||
*/
|
*/
|
||||||
public IotDevice selectIotDeviceById(Long deviceId);
|
public IotDevice selectIotDeviceById(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号查询设备
|
||||||
|
*/
|
||||||
|
public IotDevice selectIotDeviceByNum(String deviceNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*
|
*
|
||||||
* @param iotDevice 设备
|
* @param iotDevice 设备
|
||||||
* @return 设备集合
|
* @return 设备集合
|
||||||
*/
|
*/
|
||||||
public List<IotDevice> selectIotDeviceList(IotDevice iotDevice);
|
public List<IotDeviceListDto> selectIotDeviceList(IotDevice iotDevice);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ public interface IIotDeviceStatusService
|
|||||||
*/
|
*/
|
||||||
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId);
|
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号查询设备最新状态
|
||||||
|
*
|
||||||
|
* @param deviceNum 设备编号
|
||||||
|
* @return 设备状态
|
||||||
|
*/
|
||||||
|
public IotDeviceStatus selectIotDeviceStatusByDeviceNum(String deviceNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备状态列表
|
* 查询设备状态列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.IotGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组Service接口
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-18
|
||||||
|
*/
|
||||||
|
public interface IIotGroupService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询分组
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 分组
|
||||||
|
*/
|
||||||
|
public IotGroup selectIotGroupById(Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分组列表
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 分组集合
|
||||||
|
*/
|
||||||
|
public List<IotGroup> selectIotGroupList(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertIotGroup(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateIotGroup(IotGroup iotGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除分组
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的分组ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteIotGroupByIds(Long[] groupIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分组信息
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteIotGroupById(Long groupId);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.system.domain.vo.IotDeviceListDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.system.mapper.IotDeviceMapper;
|
import com.ruoyi.system.mapper.IotDeviceMapper;
|
||||||
@@ -32,6 +33,18 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|||||||
return iotDeviceMapper.selectIotDeviceById(deviceId);
|
return iotDeviceMapper.selectIotDeviceById(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号查询设备
|
||||||
|
*
|
||||||
|
* @param deviceNum 设备编号
|
||||||
|
* @return 设备
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IotDevice selectIotDeviceByNum(String deviceNum)
|
||||||
|
{
|
||||||
|
return iotDeviceMapper.selectIotDeviceByNum(deviceNum);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*
|
*
|
||||||
@@ -39,7 +52,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|||||||
* @return 设备
|
* @return 设备
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IotDevice> selectIotDeviceList(IotDevice iotDevice)
|
public List<IotDeviceListDto> selectIotDeviceList(IotDevice iotDevice)
|
||||||
{
|
{
|
||||||
return iotDeviceMapper.selectIotDeviceList(iotDevice);
|
return iotDeviceMapper.selectIotDeviceList(iotDevice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ public class IotDeviceStatusServiceImpl implements IIotDeviceStatusService
|
|||||||
return iotDeviceStatusMapper.selectIotDeviceStatusByDeviceId(deviceId);
|
return iotDeviceStatusMapper.selectIotDeviceStatusByDeviceId(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备编号查询最新设备状态
|
||||||
|
*
|
||||||
|
* @param deviceNum 设备编号
|
||||||
|
* @return 设备状态
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IotDeviceStatus selectIotDeviceStatusByDeviceNum(String deviceNum)
|
||||||
|
{
|
||||||
|
return iotDeviceStatusMapper.selectIotDeviceStatusByDeviceNum(deviceNum);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备状态列表
|
* 查询设备状态列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.mapper.IotGroupMapper;
|
||||||
|
import com.ruoyi.system.domain.IotGroup;
|
||||||
|
import com.ruoyi.system.service.IIotGroupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组Service业务层处理
|
||||||
|
*
|
||||||
|
* @author kerwincui
|
||||||
|
* @date 2021-05-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IotGroupServiceImpl implements IIotGroupService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IotGroupMapper iotGroupMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分组
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 分组
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IotGroup selectIotGroupById(Long groupId)
|
||||||
|
{
|
||||||
|
return iotGroupMapper.selectIotGroupById(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分组列表
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 分组
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<IotGroup> selectIotGroupList(IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
return iotGroupMapper.selectIotGroupList(iotGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertIotGroup(IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
iotGroup.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return iotGroupMapper.insertIotGroup(iotGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改分组
|
||||||
|
*
|
||||||
|
* @param iotGroup 分组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateIotGroup(IotGroup iotGroup)
|
||||||
|
{
|
||||||
|
iotGroup.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return iotGroupMapper.updateIotGroup(iotGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除分组
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的分组ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteIotGroupByIds(Long[] groupIds)
|
||||||
|
{
|
||||||
|
return iotGroupMapper.deleteIotGroupByIds(groupIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分组信息
|
||||||
|
*
|
||||||
|
* @param groupId 分组ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteIotGroupById(Long groupId)
|
||||||
|
{
|
||||||
|
return iotGroupMapper.deleteIotGroupById(groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,14 +18,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="IotDeviceListDto" id="IotDeviceListResult">
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceNum" column="device_num" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="deviceName" column="device_name" />
|
||||||
|
<result property="firmwareVersion" column="firmware_version" />
|
||||||
|
<result property="ownerId" column="owner_id" />
|
||||||
|
<result property="nickName" column="nick_name" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="isAlarm" column="is_alarm" />
|
||||||
|
<result property="isRadar" column="is_radar" />
|
||||||
|
<result property="isRfControl" column="is_rf_control" />
|
||||||
|
<result property="networkAddress" column="network_address" />
|
||||||
|
<result property="networkIp" column="network_ip" />
|
||||||
|
<result property="relayStatus" column="relay_status" />
|
||||||
|
<result property="lightStatus" column="light_status" />
|
||||||
|
<result property="isOnline" column="is_online" />
|
||||||
|
<result property="deviceTemperature" column="device_temperature" />
|
||||||
|
<result property="rssi" column="rssi" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectIotDeviceVo">
|
<sql id="selectIotDeviceVo">
|
||||||
select device_id, device_num, category_id, device_name, firmware_version, owner_id, create_by, create_time, update_by, update_time, remark from iot_device
|
select device_id, device_num, category_id, device_name, firmware_version, owner_id, create_by, create_time, update_by, update_time, remark from iot_device
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceResult">
|
<sql id="selectIotDeviceListVo">
|
||||||
<include refid="selectIotDeviceVo"/>
|
select d.device_id, d.device_num, d.category_id, d.device_name, d.firmware_version, d.owner_id, d.create_time,
|
||||||
|
s.relay_status,s.light_status,s.is_online,s.rssi,s.device_temperature,
|
||||||
|
t.network_address, t.network_ip,t.is_alarm, t.is_radar,t.is_rf_control,
|
||||||
|
u.nick_name
|
||||||
|
from iot_device d
|
||||||
|
left join (select * from iot_device_set order by create_time desc limit 1) as t on d.device_id = t.device_id
|
||||||
|
left join (select * from iot_device_status order by create_time desc limit 1 ) as s on d.device_id=s.device_id
|
||||||
|
left join sys_user u on d.owner_id=u.user_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceListResult">
|
||||||
|
<include refid="selectIotDeviceListVo"/>
|
||||||
<where>
|
<where>
|
||||||
del_flag= '0'
|
d.del_flag= '0'
|
||||||
<if test="deviceNum != null and deviceNum != ''"> and device_num like concat('%', #{deviceNum}, '%')</if>
|
<if test="deviceNum != null and deviceNum != ''"> and device_num like concat('%', #{deviceNum}, '%')</if>
|
||||||
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||||
@@ -40,6 +72,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectIotDeviceByNum" parameterType="String" resultMap="IotDeviceResult">
|
||||||
|
<include refid="selectIotDeviceVo"/>
|
||||||
|
where device_num = #{deviceNum}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertIotDevice" parameterType="IotDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertIotDevice" parameterType="IotDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
||||||
insert into iot_device
|
insert into iot_device
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="isHost" column="is_host" />
|
<result property="isHost" column="is_host" />
|
||||||
<result property="isReset" column="is_reset" />
|
<result property="isReset" column="is_reset" />
|
||||||
<result property="isAp" column="is_ap" />
|
<result property="isAp" column="is_ap" />
|
||||||
|
<result property="isWifiOffline" column="is_wifi_offline" />
|
||||||
|
<result property="isOpenCertifi" column="is_open_certifi" />
|
||||||
|
<result property="isSmartConfig" column="is_smart_config" />
|
||||||
<result property="isRfControl" column="is_rf_control" />
|
<result property="isRfControl" column="is_rf_control" />
|
||||||
<result property="isRfLearn" column="is_rf_learn" />
|
<result property="isRfLearn" column="is_rf_learn" />
|
||||||
<result property="isRfClear" column="is_rf_clear" />
|
<result property="isRfClear" column="is_rf_clear" />
|
||||||
@@ -23,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="ownerId" column="owner_id" />
|
<result property="ownerId" column="owner_id" />
|
||||||
<result property="networkAddress" column="network_address" />
|
<result property="networkAddress" column="network_address" />
|
||||||
<result property="networkIp" column="network_ip" />
|
<result property="networkIp" column="network_ip" />
|
||||||
|
<result property="radarInterval" column="radar_interval" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
@@ -31,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectIotDeviceSetVo">
|
<sql id="selectIotDeviceSetVo">
|
||||||
select device_set_id, device_id, device_num, is_alarm, is_radar, is_host, is_reset, is_ap, is_rf_control, is_rf_learn, is_rf_clear, rf_one_func, rf_two_func, rf_three_func, rf_four_func, owner_id, network_address, network_ip, create_by, create_time, update_by, update_time, remark from iot_device_set
|
select device_set_id, device_id, device_num, is_alarm, is_radar, is_host, is_reset, is_ap, is_wifi_offline, is_open_certifi, is_smart_config, is_rf_control, is_rf_learn, is_rf_clear, rf_one_func, rf_two_func, rf_three_func, rf_four_func, owner_id, network_address, network_ip,radar_interval, create_by, create_time, update_by, update_time, remark from iot_device_set
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectIotDeviceSetList" parameterType="IotDeviceSet" resultMap="IotDeviceSetResult">
|
<select id="selectIotDeviceSetList" parameterType="IotDeviceSet" resultMap="IotDeviceSetResult">
|
||||||
@@ -48,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="networkAddress != null and networkAddress != ''"> and network_address like concat('%', #{networkAddress}, '%')</if>
|
<if test="networkAddress != null and networkAddress != ''"> and network_address like concat('%', #{networkAddress}, '%')</if>
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectIotDeviceSetById" parameterType="Long" resultMap="IotDeviceSetResult">
|
<select id="selectIotDeviceSetById" parameterType="Long" resultMap="IotDeviceSetResult">
|
||||||
@@ -73,6 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isHost != null">is_host,</if>
|
<if test="isHost != null">is_host,</if>
|
||||||
<if test="isReset != null">is_reset,</if>
|
<if test="isReset != null">is_reset,</if>
|
||||||
<if test="isAp != null">is_ap,</if>
|
<if test="isAp != null">is_ap,</if>
|
||||||
|
<if test="isWifiOffline != null">is_wifi_offline,</if>
|
||||||
|
<if test="isOpenCertifi != null">is_open_certifi,</if>
|
||||||
|
<if test="isSmartConfig != null">is_smart_config,</if>
|
||||||
<if test="isRfControl != null">is_rf_control,</if>
|
<if test="isRfControl != null">is_rf_control,</if>
|
||||||
<if test="isRfLearn != null">is_rf_learn,</if>
|
<if test="isRfLearn != null">is_rf_learn,</if>
|
||||||
<if test="isRfClear != null">is_rf_clear,</if>
|
<if test="isRfClear != null">is_rf_clear,</if>
|
||||||
@@ -83,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="ownerId != null">owner_id,</if>
|
<if test="ownerId != null">owner_id,</if>
|
||||||
<if test="networkAddress != null">network_address,</if>
|
<if test="networkAddress != null">network_address,</if>
|
||||||
<if test="networkIp != null">network_ip,</if>
|
<if test="networkIp != null">network_ip,</if>
|
||||||
|
<if test="radarInterval != null">radar_interval,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
@@ -98,6 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isHost != null">#{isHost},</if>
|
<if test="isHost != null">#{isHost},</if>
|
||||||
<if test="isReset != null">#{isReset},</if>
|
<if test="isReset != null">#{isReset},</if>
|
||||||
<if test="isAp != null">#{isAp},</if>
|
<if test="isAp != null">#{isAp},</if>
|
||||||
|
<if test="isWifiOffline != null">#{isWifiOffline},</if>
|
||||||
|
<if test="isOpenCertifi != null">#{isOpenCertifi},</if>
|
||||||
|
<if test="isSmartConfig != null">#{isSmartConfig},</if>
|
||||||
<if test="isRfControl != null">#{isRfControl},</if>
|
<if test="isRfControl != null">#{isRfControl},</if>
|
||||||
<if test="isRfLearn != null">#{isRfLearn},</if>
|
<if test="isRfLearn != null">#{isRfLearn},</if>
|
||||||
<if test="isRfClear != null">#{isRfClear},</if>
|
<if test="isRfClear != null">#{isRfClear},</if>
|
||||||
@@ -108,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="ownerId != null">#{ownerId},</if>
|
<if test="ownerId != null">#{ownerId},</if>
|
||||||
<if test="networkAddress != null">#{networkAddress},</if>
|
<if test="networkAddress != null">#{networkAddress},</if>
|
||||||
<if test="networkIp != null">#{networkIp},</if>
|
<if test="networkIp != null">#{networkIp},</if>
|
||||||
|
<if test="radarInterval != null">#{radarInterval},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
@@ -126,6 +139,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isHost != null">is_host = #{isHost},</if>
|
<if test="isHost != null">is_host = #{isHost},</if>
|
||||||
<if test="isReset != null">is_reset = #{isReset},</if>
|
<if test="isReset != null">is_reset = #{isReset},</if>
|
||||||
<if test="isAp != null">is_ap = #{isAp},</if>
|
<if test="isAp != null">is_ap = #{isAp},</if>
|
||||||
|
<if test="isWifiOffline != null">is_wifi_offline = #{isWifiOffline},</if>
|
||||||
|
<if test="isOpenCertifi != null">is_open_certifi = #{isOpenCertifi},</if>
|
||||||
|
<if test="isSmartConfig != null">is_smart_config = #{isSmartConfig},</if>
|
||||||
<if test="isRfControl != null">is_rf_control = #{isRfControl},</if>
|
<if test="isRfControl != null">is_rf_control = #{isRfControl},</if>
|
||||||
<if test="isRfLearn != null">is_rf_learn = #{isRfLearn},</if>
|
<if test="isRfLearn != null">is_rf_learn = #{isRfLearn},</if>
|
||||||
<if test="isRfClear != null">is_rf_clear = #{isRfClear},</if>
|
<if test="isRfClear != null">is_rf_clear = #{isRfClear},</if>
|
||||||
@@ -136,6 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="ownerId != null">owner_id = #{ownerId},</if>
|
<if test="ownerId != null">owner_id = #{ownerId},</if>
|
||||||
<if test="networkAddress != null">network_address = #{networkAddress},</if>
|
<if test="networkAddress != null">network_address = #{networkAddress},</if>
|
||||||
<if test="networkIp != null">network_ip = #{networkIp},</if>
|
<if test="networkIp != null">network_ip = #{networkIp},</if>
|
||||||
|
<if test="radarInterval != null">radar_interval = #{radarInterval},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="lightStatus" column="light_status" />
|
<result property="lightStatus" column="light_status" />
|
||||||
<result property="isOnline" column="is_online" />
|
<result property="isOnline" column="is_online" />
|
||||||
<result property="deviceTemperature" column="device_temperature" />
|
<result property="deviceTemperature" column="device_temperature" />
|
||||||
<result property="deviceHumidity" column="device_humidity" />
|
<result property="rssi" column="rssi" />
|
||||||
<result property="airTemperature" column="air_temperature" />
|
<result property="airTemperature" column="air_temperature" />
|
||||||
<result property="airHumidity" column="air_humidity" />
|
<result property="airHumidity" column="air_humidity" />
|
||||||
<result property="triggerSource" column="trigger_source" />
|
<result property="triggerSource" column="trigger_source" />
|
||||||
<result property="brightness" column="brightness" />
|
<result property="brightness" column="brightness" />
|
||||||
<result property="lightInterval" column="light_interval" />
|
<result property="lightInterval" column="light_interval" />
|
||||||
<result property="lightMode" column="light_mode" />
|
<result property="lightMode" column="light_mode" />
|
||||||
|
<result property="fadeTime" column="fade_time" />
|
||||||
<result property="red" column="red" />
|
<result property="red" column="red" />
|
||||||
<result property="green" column="green" />
|
<result property="green" column="green" />
|
||||||
<result property="blue" column="blue" />
|
<result property="blue" column="blue" />
|
||||||
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectIotDeviceStatusVo">
|
<sql id="selectIotDeviceStatusVo">
|
||||||
select device_status_id, device_id, device_num, relay_status, light_status, is_online, device_temperature, device_humidity, air_temperature, air_humidity, trigger_source, brightness, light_interval, light_mode, red, green, blue, create_by, create_time, update_by, update_time, remark from iot_device_status
|
select device_status_id, device_id, device_num, relay_status, light_status, is_online, device_temperature, rssi, air_temperature, air_humidity, trigger_source, brightness, light_interval, light_mode,fade_time, red, green, blue, create_by, create_time, update_by, update_time, remark from iot_device_status
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectIotDeviceStatusList" parameterType="IotDeviceStatus" resultMap="IotDeviceStatusResult">
|
<select id="selectIotDeviceStatusList" parameterType="IotDeviceStatus" resultMap="IotDeviceStatusResult">
|
||||||
@@ -45,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="triggerSource != null "> and trigger_source = #{triggerSource}</if>
|
<if test="triggerSource != null "> and trigger_source = #{triggerSource}</if>
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectIotDeviceStatusById" parameterType="Long" resultMap="IotDeviceStatusResult">
|
<select id="selectIotDeviceStatusById" parameterType="Long" resultMap="IotDeviceStatusResult">
|
||||||
@@ -59,6 +61,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectIotDeviceStatusByDeviceNum" parameterType="String" resultMap="IotDeviceStatusResult">
|
||||||
|
<include refid="selectIotDeviceStatusVo"/>
|
||||||
|
where device_num = #{deviceNum}
|
||||||
|
order by create_time desc
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertIotDeviceStatus" parameterType="IotDeviceStatus" useGeneratedKeys="true" keyProperty="deviceStatusId">
|
<insert id="insertIotDeviceStatus" parameterType="IotDeviceStatus" useGeneratedKeys="true" keyProperty="deviceStatusId">
|
||||||
insert into iot_device_status
|
insert into iot_device_status
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -68,13 +77,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="lightStatus != null">light_status,</if>
|
<if test="lightStatus != null">light_status,</if>
|
||||||
<if test="isOnline != null">is_online,</if>
|
<if test="isOnline != null">is_online,</if>
|
||||||
<if test="deviceTemperature != null">device_temperature,</if>
|
<if test="deviceTemperature != null">device_temperature,</if>
|
||||||
<if test="deviceHumidity != null">device_humidity,</if>
|
<if test="rssi != null">rssi,</if>
|
||||||
<if test="airTemperature != null">air_temperature,</if>
|
<if test="airTemperature != null">air_temperature,</if>
|
||||||
<if test="airHumidity != null">air_humidity,</if>
|
<if test="airHumidity != null">air_humidity,</if>
|
||||||
<if test="triggerSource != null">trigger_source,</if>
|
<if test="triggerSource != null">trigger_source,</if>
|
||||||
<if test="brightness != null">brightness,</if>
|
<if test="brightness != null">brightness,</if>
|
||||||
<if test="lightInterval != null">light_interval,</if>
|
<if test="lightInterval != null">light_interval,</if>
|
||||||
<if test="lightMode != null">light_mode,</if>
|
<if test="lightMode != null">light_mode,</if>
|
||||||
|
<if test="fadeTime != null">fade_time,</if>
|
||||||
<if test="red != null">red,</if>
|
<if test="red != null">red,</if>
|
||||||
<if test="green != null">green,</if>
|
<if test="green != null">green,</if>
|
||||||
<if test="blue != null">blue,</if>
|
<if test="blue != null">blue,</if>
|
||||||
@@ -91,13 +101,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="lightStatus != null">#{lightStatus},</if>
|
<if test="lightStatus != null">#{lightStatus},</if>
|
||||||
<if test="isOnline != null">#{isOnline},</if>
|
<if test="isOnline != null">#{isOnline},</if>
|
||||||
<if test="deviceTemperature != null">#{deviceTemperature},</if>
|
<if test="deviceTemperature != null">#{deviceTemperature},</if>
|
||||||
<if test="deviceHumidity != null">#{deviceHumidity},</if>
|
<if test="rssi != null">#{rssi},</if>
|
||||||
<if test="airTemperature != null">#{airTemperature},</if>
|
<if test="airTemperature != null">#{airTemperature},</if>
|
||||||
<if test="airHumidity != null">#{airHumidity},</if>
|
<if test="airHumidity != null">#{airHumidity},</if>
|
||||||
<if test="triggerSource != null">#{triggerSource},</if>
|
<if test="triggerSource != null">#{triggerSource},</if>
|
||||||
<if test="brightness != null">#{brightness},</if>
|
<if test="brightness != null">#{brightness},</if>
|
||||||
<if test="lightInterval != null">#{lightInterval},</if>
|
<if test="lightInterval != null">#{lightInterval},</if>
|
||||||
<if test="lightMode != null">#{lightMode},</if>
|
<if test="lightMode != null">#{lightMode},</if>
|
||||||
|
<if test="fadeTime != null">#{fadeTime},</if>
|
||||||
<if test="red != null">#{red},</if>
|
<if test="red != null">#{red},</if>
|
||||||
<if test="green != null">#{green},</if>
|
<if test="green != null">#{green},</if>
|
||||||
<if test="blue != null">#{blue},</if>
|
<if test="blue != null">#{blue},</if>
|
||||||
@@ -118,13 +129,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="lightStatus != null">light_status = #{lightStatus},</if>
|
<if test="lightStatus != null">light_status = #{lightStatus},</if>
|
||||||
<if test="isOnline != null">is_online = #{isOnline},</if>
|
<if test="isOnline != null">is_online = #{isOnline},</if>
|
||||||
<if test="deviceTemperature != null">device_temperature = #{deviceTemperature},</if>
|
<if test="deviceTemperature != null">device_temperature = #{deviceTemperature},</if>
|
||||||
<if test="deviceHumidity != null">device_humidity = #{deviceHumidity},</if>
|
<if test="rssi != null">rssi = #{rssi},</if>
|
||||||
<if test="airTemperature != null">air_temperature = #{airTemperature},</if>
|
<if test="airTemperature != null">air_temperature = #{airTemperature},</if>
|
||||||
<if test="airHumidity != null">air_humidity = #{airHumidity},</if>
|
<if test="airHumidity != null">air_humidity = #{airHumidity},</if>
|
||||||
<if test="triggerSource != null">trigger_source = #{triggerSource},</if>
|
<if test="triggerSource != null">trigger_source = #{triggerSource},</if>
|
||||||
<if test="brightness != null">brightness = #{brightness},</if>
|
<if test="brightness != null">brightness = #{brightness},</if>
|
||||||
<if test="lightInterval != null">light_interval = #{lightInterval},</if>
|
<if test="lightInterval != null">light_interval = #{lightInterval},</if>
|
||||||
<if test="lightMode != null">light_mode = #{lightMode},</if>
|
<if test="lightMode != null">light_mode = #{lightMode},</if>
|
||||||
|
<if test="fadeTime != null">fade_time = #{fadeTime},</if>
|
||||||
<if test="red != null">red = #{red},</if>
|
<if test="red != null">red = #{red},</if>
|
||||||
<if test="green != null">green = #{green},</if>
|
<if test="green != null">green = #{green},</if>
|
||||||
<if test="blue != null">blue = #{blue},</if>
|
<if test="blue != null">blue = #{blue},</if>
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?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.ruoyi.system.mapper.IotGroupMapper">
|
||||||
|
|
||||||
|
<resultMap type="IotGroup" id="IotGroupResult">
|
||||||
|
<result property="groupId" column="group_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="groupName" column="group_name" />
|
||||||
|
<result property="groupOrder" column="group_order" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectIotGroupVo">
|
||||||
|
select group_id, user_id, group_name, group_order, del_flag, create_by, create_time, update_by, update_time, remark from iot_group
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectIotGroupList" parameterType="IotGroup" resultMap="IotGroupResult">
|
||||||
|
<include refid="selectIotGroupVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||||
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectIotGroupById" parameterType="Long" resultMap="IotGroupResult">
|
||||||
|
<include refid="selectIotGroupVo"/>
|
||||||
|
where group_id = #{groupId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertIotGroup" parameterType="IotGroup" useGeneratedKeys="true" keyProperty="groupId">
|
||||||
|
insert into iot_group
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name,</if>
|
||||||
|
<if test="groupOrder != null">group_order,</if>
|
||||||
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">#{groupName},</if>
|
||||||
|
<if test="groupOrder != null">#{groupOrder},</if>
|
||||||
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateIotGroup" parameterType="IotGroup">
|
||||||
|
update iot_group
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
|
||||||
|
<if test="groupOrder != null">group_order = #{groupOrder},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where group_id = #{groupId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteIotGroupById" parameterType="Long">
|
||||||
|
delete from iot_group where group_id = #{groupId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteIotGroupByIds" parameterType="String">
|
||||||
|
delete from iot_group where group_id in
|
||||||
|
<foreach item="groupId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{groupId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user