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

@@ -1,15 +1,18 @@
package cn.nopj.chaos_api.service;
import cn.nopj.chaos_api.dto.request.CreateDriveRequest;
import cn.nopj.chaos_api.dto.request.CreateDeviceRequest;
import cn.nopj.chaos_api.dto.request.DeviceQueryRequest;
import cn.nopj.chaos_api.dto.request.UpdateDeviceRequest;
import cn.nopj.chaos_api.dto.response.DeviceResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
public interface DeviceService {
/**
* 新建设备信息
* @param createDriveRequest 设备信息
* @param createDeviceRequest 设备信息
* @return 新建设备信息结果
*/
DeviceResponse createDevice(CreateDriveRequest createDriveRequest);
DeviceResponse createDevice(CreateDeviceRequest createDeviceRequest);
/**
* 根据id查询设备信息
@@ -29,4 +32,17 @@ public interface DeviceService {
* @param id 设备id
*/
void deleteDeviceReal(Long id);
/**
* 查询所有设备信息
* @return 所有设备信息
*/
IPage<DeviceResponse> getAllDevices(DeviceQueryRequest request);
/**
* 更新设备信息
* @param updateDeviceRequest 设备信息
* @return 更新设备信息结果
*/
DeviceResponse updateDevice(UpdateDeviceRequest updateDeviceRequest);
}

View File

@@ -1,6 +1,7 @@
package cn.nopj.chaos_api.service;
import cn.nopj.chaos_api.dto.response.DeviceTypeResponse;
import cn.nopj.chaos_api.dto.response.OptionResponse;
import java.util.List;
@@ -10,4 +11,10 @@ public interface DeviceTypeService {
* @return 所有设备类型
*/
List<DeviceTypeResponse> getAllDeviceTypes();
/**
* 获取设备类型选项
* @return 设备类型选项
*/
List<OptionResponse> getDeviceTypeOptions();
}