forked from dyf/fys-Multi-tenant
设备类型管理
This commit is contained in:
@ -0,0 +1,84 @@
|
||||
package com.fuyuanshen.equipment.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
import com.fuyuanshen.common.core.domain.ResponseVO;
|
||||
import com.fuyuanshen.equipment.domain.DeviceType;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
||||
import com.fuyuanshen.equipment.service.DeviceTypeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/13
|
||||
**/
|
||||
@Tag(name = "设备类型管理", description = "设备类型管理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/deviceType")
|
||||
public class DeviceTypeController {
|
||||
|
||||
private final DeviceTypeService deviceTypeService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "分页查询设备类型")
|
||||
public ResponseVO<PageResult<DeviceType>> queryDeviceType(DeviceTypeQueryCriteria criteria) {
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return ResponseVO.success(deviceTypeService.queryAll(criteria, page));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/all")
|
||||
@Operation(summary = "查询所有设备类型")
|
||||
public ResponseVO<Object> queryDeviceTypes() {
|
||||
List<DeviceType> deviceTypes = deviceTypeService.queryDeviceTypes();
|
||||
return ResponseVO.success(deviceTypes);
|
||||
}
|
||||
|
||||
|
||||
// @Log("新增设备类型")
|
||||
@Operation(summary = "新增设备类型")
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseVO<Object> createDeviceType(@Validated @RequestBody DeviceType resources) {
|
||||
deviceTypeService.create(resources);
|
||||
return ResponseVO.success(null);
|
||||
}
|
||||
|
||||
|
||||
// @Log("修改设备类型")
|
||||
@Operation(summary = "修改设备类型")
|
||||
@PutMapping(value = "/update")
|
||||
public ResponseVO<Object> updateDeviceType(@Validated @RequestBody DeviceType resources) {
|
||||
deviceTypeService.update(resources);
|
||||
return ResponseVO.success(null);
|
||||
}
|
||||
|
||||
|
||||
// @Log("删除设备类型")
|
||||
@Operation(summary = "删除设备类型")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public ResponseEntity<Object> deleteDeviceType(@Parameter(name = "传ID数组[]") @RequestBody List<Long> ids) {
|
||||
deviceTypeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/communicationMode")
|
||||
@Operation(summary = "获取设备类型通讯方式")
|
||||
public ResponseVO<DeviceType> getCommunicationMode(@Parameter(name = "设备类型ID", required = true) Long id) {
|
||||
return ResponseVO.success(deviceTypeService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user