55 lines
2.1 KiB
Java
55 lines
2.1 KiB
Java
|
|
package com.whdc.zhdbaqapi.controller;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||
|
|
import com.whdc.zhdbaqapi.mapper.DeviceRobotPointMapper;
|
||
|
|
import com.whdc.zhdbaqapi.model.dto.FindPageDto;
|
||
|
|
import com.whdc.zhdbaqapi.model.dto.IntegerIdDto;
|
||
|
|
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||
|
|
import com.whdc.zhdbaqapi.model.entity.DeviceRobot;
|
||
|
|
import com.whdc.zhdbaqapi.utils.ResultJson;
|
||
|
|
import io.swagger.annotations.Api;
|
||
|
|
import io.swagger.annotations.ApiOperation;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.validation.annotation.Validated;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
import java.util.Date;
|
||
|
|
|
||
|
|
@Api(tags = "变形机器人信息 - Controller")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/v1/deviceRobotInfo")
|
||
|
|
@Slf4j
|
||
|
|
public class DeviceRobotController {
|
||
|
|
@Autowired
|
||
|
|
private DeviceRobotPointMapper deviceRobotPointMapper;
|
||
|
|
|
||
|
|
@ApiOperation(value = "新增")
|
||
|
|
@PostMapping("/save/point")
|
||
|
|
public ResultJson<Boolean> save(@RequestBody @Validated DeviceRobot bean) {
|
||
|
|
bean.getPoint().setEpoch(new Date());
|
||
|
|
return ResultJson.ok(deviceRobotPointMapper.insert(bean.getPoint()) == 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "删除")
|
||
|
|
@PostMapping("/del/point")
|
||
|
|
public ResultJson<Boolean> del(@RequestBody @Validated IntegerIdDto bean) {
|
||
|
|
return ResultJson.ok(deviceRobotPointMapper.deleteById(bean.getId()) == 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "修改")
|
||
|
|
@PostMapping("/edit/point")
|
||
|
|
public ResultJson<Boolean> edit(@RequestBody @Validated DeviceRobot bean) {
|
||
|
|
return ResultJson.ok(deviceRobotPointMapper.updateById(bean.getPoint()) == 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "分页查询")
|
||
|
|
@PostMapping(value = "/page/point")
|
||
|
|
public ResultJson<IPage<DeviceInfo>> page(@RequestBody FindPageDto findDto) {
|
||
|
|
return ResultJson.ok(deviceRobotPointMapper.page(findDto.getPage()));
|
||
|
|
}
|
||
|
|
}
|