| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package com.zswl.dataservice.controller;
- import com.zswl.dataservice.model.mqtt.*;
- import com.zswl.dataservice.service.mqtt.GateWayInfoService;
- import com.zswl.dataservice.utils.result.ResultContent;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.Parameter;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.domain.Page;
- import org.springframework.data.domain.Pageable;
- import org.springframework.data.web.PageableDefault;
- import org.springframework.util.Assert;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 网关管理 服务
- *
- * @author TRX
- * @date 2024/3/21
- */
- @RequestMapping("/gateWay/free")
- @RestController
- @Validated
- @Tag(name = "网关管理")
- public class GateWayController {
- @Autowired
- GateWayInfoService gateWayInfoService;
- @Operation(summary = "添加网关")
- @RequestMapping(value = "addDeviceInfo", method = {RequestMethod.POST})
- public ResultContent addDeviceInfo(@RequestBody GateWayInfoAddParam param) {
- Assert.hasText(param.getGateWayId(), "网关ID不能为空");
- Assert.hasText(param.getGateWayName(), "网关名称不能为空");
- return gateWayInfoService.addGateWayInfo(param);
- }
- @Operation(summary = "网关列表-分页查询")
- @RequestMapping(value = {"pageGateWay"}, method = {RequestMethod.POST})
- public ResultContent<Page<GateWayInfoModel>> pageGateWay(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, GateWayInfoSearchParam param) {
- return gateWayInfoService.pageGateWay(pageable, param);
- }
- @Operation(summary = "删除网关")
- @RequestMapping(value = "deleteGateWayInfo", method = {RequestMethod.GET})
- public ResultContent deleteGateWayInfo(String gateWayId) {
- return gateWayInfoService.deleteGateWayInfo(gateWayId);
- }
- @Operation(summary = "查询网关")
- @RequestMapping(value = "getGateWayById", method = {RequestMethod.GET})
- public ResultContent<GateWayInfoModel> getGateWayById(String deviceId) {
- return gateWayInfoService.getById(deviceId);
- }
- @Operation(summary = "网关绑定设备、连接账号")
- @RequestMapping(value = "gateWayBindDevice", method = {RequestMethod.POST})
- public ResultContent gateWayBindDevice(@RequestBody GateWayBindDeviceParam param) {
- Assert.hasText(param.getGateWayId(), "网关ID不能为空");
- Assert.hasText(param.getUserName(), "连接账号不能为空");
- return gateWayInfoService.gateWayBindDevice(param);
- }
- }
|