forked from dyf/fys-Multi-tenant
添加设备
This commit is contained in:
@ -5,10 +5,15 @@ 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.Device;
|
||||
import com.fuyuanshen.equipment.domain.dto.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.service.DeviceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -19,7 +24,7 @@ import java.io.IOException;
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Slf4j
|
||||
// @Api(tags = "设备:设备管理")
|
||||
@Tag(name = "设备管理", description = "设备:设备管理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/device")
|
||||
@ -28,7 +33,7 @@ public class DeviceController {
|
||||
private final DeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "分页查询设备列表", security = {@SecurityRequirement(name = "bearer-key")})
|
||||
@GetMapping
|
||||
public ResponseVO<PageResult<Device>> queryDevice(DeviceQueryCriteria criteria) {
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
@ -42,19 +47,19 @@ public class DeviceController {
|
||||
return ResponseVO.success(devices);
|
||||
}
|
||||
|
||||
//
|
||||
// @Log("新增设备")
|
||||
// @ApiOperation("新增设备")
|
||||
// @PostMapping(value = "/add")
|
||||
// public ResponseVO<Object> addDevice(@Validated @ModelAttribute DeviceForm deviceForm) {
|
||||
// try {
|
||||
// deviceService.addDevice(deviceForm);
|
||||
// } catch (Exception e) {
|
||||
// log.error("addDevice error: " + e.getMessage());
|
||||
// return ResponseVO.fail(e.getMessage());
|
||||
// }
|
||||
// return ResponseVO.success(null);
|
||||
// }
|
||||
|
||||
// @Log("新增设备")
|
||||
@Operation(summary = "新增设备")
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseVO<Object> addDevice(@Validated @ModelAttribute DeviceForm deviceForm) {
|
||||
try {
|
||||
deviceService.addDevice(deviceForm);
|
||||
} catch (Exception e) {
|
||||
log.error("addDevice error: " + e.getMessage());
|
||||
return ResponseVO.fail(e.getMessage());
|
||||
}
|
||||
return ResponseVO.success(null);
|
||||
}
|
||||
//
|
||||
//
|
||||
// /**
|
||||
|
Reference in New Issue
Block a user