| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package com.zswl.dataservice.controller;
- import com.zswl.dataservice.model.mqtt.*;
- import com.zswl.dataservice.service.mqtt.DeviceInfoService;
- import com.zswl.dataservice.service.mqtt.GateWayUserInfoService;
- 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("/gateWayUserInfo/free")
- @RestController
- @Validated
- @Tag(name = "连接用户管理")
- public class GateWayUserInfoController {
- @Autowired
- GateWayUserInfoService gateWayUserInfoService;
- @Operation(summary = "添加连接用户")
- @RequestMapping(value = "addDeviceInfo", method = {RequestMethod.POST})
- public ResultContent addDeviceInfo(@RequestBody GateWayUserInfoAddParam param) {
- Assert.hasText(param.getUserName(), "连接账号不能为空");
- Assert.hasText(param.getPassWord(), "连接密码不能为空");
- return gateWayUserInfoService.addGateWayUser(param);
- }
- @Operation(summary = "连接用户列表-分页查询")
- @RequestMapping(value = {"pageGateWayUser"}, method = {RequestMethod.POST})
- public ResultContent<Page<GateWayUserInfoModel>> pageGateWayUser(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10, sort = "") Pageable pageable, @Parameter(required = false) GateWayUserInfoSearchParam param) {
- return gateWayUserInfoService.pageGateWayUser(pageable, param);
- }
- @Operation(summary = "删除连接用户")
- @RequestMapping(value = "deleteMqttUser", method = {RequestMethod.POST})
- public ResultContent deleteMqttUser(GateWayUserInfoNameParam param) {
- Assert.hasText(param.getUserName(), "连接账号不能为空");
- return gateWayUserInfoService.deleteMqttUser(param);
- }
- @Operation(summary = "启动-停用连接账号")
- @RequestMapping(value = "updateState", method = {RequestMethod.POST})
- public ResultContent updateState(GateWayUserInfoNameParam param) {
- Assert.hasText(param.getUserName(), "连接账号不能为空");
- return gateWayUserInfoService.updateState(param);
- }
- @Operation(summary = "查询连接账号")
- @RequestMapping(value = "getUserByUserName", method = {RequestMethod.POST})
- public ResultContent<GateWayUserInfoModel> getUserByUserName(GateWayUserInfoNameParam param) {
- Assert.hasText(param.getUserName(), "连接账号不能为空");
- return gateWayUserInfoService.getUserByUserName(param.getUserName());
- }
- }
|