package com.whyc.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.whyc.dto.Response;
|
import com.whyc.pojo.MotorState;
|
import com.whyc.service.MotorStateService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
@RestController
|
@RequestMapping("motorState")
|
@Api(tags = "电机-状态")
|
@Slf4j
|
public class MotorStateController {
|
@Resource
|
private MotorStateService motorStateService;
|
|
@PostMapping
|
@ApiOperation("添加")
|
public Response add(@RequestBody MotorState motorState){
|
return motorStateService.add(motorState);
|
}
|
@PutMapping
|
@ApiOperation("编辑")
|
public Response update(@RequestBody MotorState motorState){
|
return motorStateService.update(motorState);
|
}
|
@GetMapping
|
@ApiOperation("查询by设备id")
|
public Response getMontorState(@RequestParam int deviceId){
|
return motorStateService.getById(deviceId);
|
}
|
/*@PutMapping("delete")
|
public Response delete(@RequestParam Integer deviceId){
|
return motorStateService.delete(deviceId);
|
}*/
|
|
@GetMapping("/all")
|
@ApiOperation("查询所有")
|
public Response<IPage<MotorState>> getAll(@RequestParam int pageNum,@RequestParam int pageSize){
|
return motorStateService.getAll(pageNum,pageSize);
|
}
|
|
@GetMapping("ws")
|
@ApiOperation(value="查询webSocket",protocols = "ws",notes = "接口:ws://localhost:8090/websocket,发送消息为deviceId")
|
public Response doc(){
|
return new Response().setMsg(1,"查看接口描述");
|
}
|
|
}
|