75 lines
2.7 KiB
Java
75 lines
2.7 KiB
Java
|
|
package com.whdc.zhdbaqapi.controller;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||
|
|
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
||
|
|
import com.whdc.zhdbaqapi.model.dto.IntegerIdDto;
|
||
|
|
import com.whdc.zhdbaqapi.model.dto.StationCodeDto;
|
||
|
|
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||
|
|
import com.whdc.zhdbaqapi.service.IDeviceInfoService;
|
||
|
|
import com.whdc.zhdbaqapi.utils.ResultJson;
|
||
|
|
import io.swagger.annotations.Api;
|
||
|
|
import io.swagger.annotations.ApiOperation;
|
||
|
|
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.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author 李赛
|
||
|
|
* @date 2022-07-21 23:58
|
||
|
|
*/
|
||
|
|
@Api(tags = "设备信息 - Controller")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/v1/deviceInfo")
|
||
|
|
public class DeviceInfoController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private IDeviceInfoService iDeviceInfoService;
|
||
|
|
|
||
|
|
@ApiOperation(value = "获取单个对象")
|
||
|
|
@PostMapping("/get")
|
||
|
|
public ResultJson<DeviceInfo> get(@RequestBody @Validated IntegerIdDto idDto) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.get(idDto.getId()));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "新增")
|
||
|
|
@PostMapping("/save")
|
||
|
|
public ResultJson<Boolean> save(@RequestBody @Validated DeviceInfo bean) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.save(bean));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "删除")
|
||
|
|
@PostMapping("/del")
|
||
|
|
public ResultJson<Boolean> del(@RequestBody @Validated IntegerIdDto bean) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.removeById(bean.getId()));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "修改")
|
||
|
|
@PostMapping("/edit")
|
||
|
|
public ResultJson<Boolean> edit(@RequestBody @Validated DeviceInfo bean) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.updateById(bean));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "恢复")
|
||
|
|
@PostMapping("/restore")
|
||
|
|
public ResultJson<Boolean> edit(@RequestBody @Validated IntegerIdDto bean) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.restore(bean.getId()));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "列表查询")
|
||
|
|
@PostMapping(value = "/list")
|
||
|
|
public ResultJson<List<DeviceInfo>> list(@RequestBody StationCodeDto dto) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.list(dto.getStationCode()));
|
||
|
|
}
|
||
|
|
|
||
|
|
@ApiOperation(value = "分页查询")
|
||
|
|
@PostMapping(value = "/page")
|
||
|
|
public ResultJson<IPage<DeviceInfo>> page(@RequestBody FindDeviceDto findDto) {
|
||
|
|
return ResultJson.ok(iDeviceInfoService.page(findDto));
|
||
|
|
}
|
||
|
|
}
|