feat(device): refactor device management API and implement CRUD operations

- Rename CreateDriveRequest to CreateDeviceRequest
- Add DeviceQueryRequest for pagination and filtering
- Add UpdateDeviceRequest for device updates
- Refactor DeviceController with RESTful endpoints
- Implement getAllDevices with pagination and search
- Implement createDevice endpoint
- Implement updateDevice endpoint
- Implement deleteDevice endpoint
- Remove real delete endpoint
- Add DeviceResponse and OptionResponse DTOs
- Update DeviceService interface and implementation
- Add device type options endpoint
- Update device type controller mappings
This commit is contained in:
Chaos
2025-11-27 17:11:57 +08:00
parent 79ef40bd34
commit af8959220a
11 changed files with 231 additions and 33 deletions

View File

@@ -7,7 +7,7 @@ import lombok.Data;
import java.time.LocalDate;
@Data
public class CreateDriveRequest {
public class CreateDeviceRequest {
//限制必填 不限制特殊字符
@NotBlank(message = "设备名称不能为空")
private String name;

View File

@@ -0,0 +1,12 @@
package cn.nopj.chaos_api.dto.request;
import lombok.Data;
@Data
public class DeviceQueryRequest {
private Integer pageNum = 1;
private Integer pageSize = 10;
private Integer type;
private String keyword;
private String status;
}

View File

@@ -0,0 +1,22 @@
package cn.nopj.chaos_api.dto.request;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import java.time.LocalDate;
@Data
public class UpdateDeviceRequest {
@NotBlank(message = "设备id不能为空")
private Long id;
private String name;
private String model;
private Long typeId;
private Long locationId;
private String snmpCommunity;
private String manufacturer;
private LocalDate purchaseDate;
private int status;
private String remark;
}

View File

@@ -0,0 +1,20 @@
package cn.nopj.chaos_api.dto.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OptionResponse {
/**
* 选项标签
*/
private String label;
/**
* 值
*/
private String value;
}