diff --git a/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java b/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java index ce4512f..b262534 100644 --- a/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java +++ b/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java @@ -54,10 +54,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController /** * 按厂商分组查询无人机类型 * + * @param vo 无人机类型通用枚举VO * @return 按厂商分组的无人机类型列表 */ @GetMapping("/vendorGroup") - public R> selectAirTypeGeneralEnumGroupByVendor() + public R> selectAirTypeGeneralEnumGroupByVendor(AirTypeGeneralEnumVO vo) { // 从数据字典获取无人机厂商类型 R> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER); @@ -66,7 +67,8 @@ public class DeviceAirTypeGeneralEnumController extends BaseController if (dictResult.getData() != null) { // 获取所有无人机类型数据 - List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO()); + DeviceAirTypeGeneralEnumDTO dto = DeviceAirTypeGeneralEnumVOConvert.to(vo); + List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(dto); List allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList); // 为每个字典项创建分组 @@ -78,11 +80,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController // 筛选属于当前厂商的无人机类型 List vendorAirTypes = new ArrayList<>(); - for (AirTypeGeneralEnumVO vo : allVoList) + for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : allVoList) { - if (dictData.getDictValue().equals(vo.getVendorId().toString())) + if (dictData.getDictValue().equals(airTypeGeneralEnumVO.getVendorId().toString())) { - vendorAirTypes.add(vo); + vendorAirTypes.add(airTypeGeneralEnumVO); } } @@ -96,10 +98,11 @@ public class DeviceAirTypeGeneralEnumController extends BaseController /** * 按厂商分组查询无人机类型(厂商 -> 分类 -> 设备类型) * + * @param vo 无人机类型通用枚举VO * @return 按厂商分组的无人机类型列表 */ @GetMapping("/vendorGroupNew") - public R> selectAirTypeGeneralEnumGroupByVendorNew() + public R> selectAirTypeGeneralEnumGroupByVendorNew(AirTypeGeneralEnumVO vo) { // 从数据字典获取无人机厂商类型 R> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER); @@ -108,7 +111,8 @@ public class DeviceAirTypeGeneralEnumController extends BaseController if (dictResult.getData() != null) { // 获取所有无人机类型数据(包括生效和失效的) - List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO()); + DeviceAirTypeGeneralEnumDTO dto = DeviceAirTypeGeneralEnumVOConvert.to(vo); + List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(dto); List allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList); // 为每个字典项创建分组 @@ -120,26 +124,26 @@ public class DeviceAirTypeGeneralEnumController extends BaseController // 筛选属于当前厂商的无人机类型 List vendorAirTypes = new ArrayList<>(); - for (AirTypeGeneralEnumVO vo : allVoList) + for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : allVoList) { - if (dictData.getDictValue().equals(vo.getVendorId().toString())) + if (dictData.getDictValue().equals(airTypeGeneralEnumVO.getVendorId().toString())) { - vendorAirTypes.add(vo); + vendorAirTypes.add(airTypeGeneralEnumVO); } } // 按分类分组 Map> categoryMap = new HashMap<>(); - for (AirTypeGeneralEnumVO vo : vendorAirTypes) + for (AirTypeGeneralEnumVO airTypeGeneralEnumVO : vendorAirTypes) { - String category = vo.getCategory(); + String category = airTypeGeneralEnumVO.getCategory(); if (category == null || category.isEmpty()) { category = "其他"; } if (!categoryMap.containsKey(category)) { categoryMap.put(category, new ArrayList<>()); } - categoryMap.get(category).add(vo); + categoryMap.get(category).add(airTypeGeneralEnumVO); } // 构建分类分组列表 diff --git a/src/main/resources/db/migration/V5__Create_air_type_general_enum_table.sql b/src/main/resources/db/migration/V5__Create_air_type_general_enum_table.sql index 682a5c9..f346e8d 100644 --- a/src/main/resources/db/migration/V5__Create_air_type_general_enum_table.sql +++ b/src/main/resources/db/migration/V5__Create_air_type_general_enum_table.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `device_air_type_general_enum` ( `category` VARCHAR(255) DEFAULT NULL COMMENT '分类', `enabled` TINYINT DEFAULT 0 COMMENT '是否生效:0-失效,1-生效', `vendor_id` BIGINT DEFAULT NULL COMMENT '厂商ID', - `domain` BIGINT DEFAULT NULL COMMENT '领域', + `domain` BIGINT DEFAULT NULL COMMENT '领域:0:无人机;2:遥控器;3:机场', `type` BIGINT DEFAULT NULL COMMENT '主类型', `sub_type` BIGINT DEFAULT NULL COMMENT '子类型', `icon` VARCHAR(255) DEFAULT NULL COMMENT '图标', @@ -53,4 +53,8 @@ INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, do INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES ('大疆机场', '机场', 0, 1, 3, 1, 0, '-'), ('大疆机场 2', '机场', 0, 1, 3, 2, 0, '-'), - ('大疆机场 3', '机场', 0, 1, 3, 3, 0, '-'); \ No newline at end of file + ('大疆机场 3', '机场', 0, 1, 3, 3, 0, '-'); + +-- 拓恒无人机系列 +INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES + ('云003-FM', '云', 1, 0, 0, 1, 0, '-');