From 1a90e9852f9d2d08670062448fb72228c3404dd5 Mon Sep 17 00:00:00 2001 From: gyb Date: Fri, 13 Feb 2026 13:29:37 +0800 Subject: [PATCH] =?UTF-8?q?fit:=E4=BF=AE=E6=94=B9=E6=97=A0=E4=BA=BA?= =?UTF-8?q?=E6=9C=BA=E7=B1=BB=E5=9E=8B=E8=A1=A8=E5=92=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=EF=BC=9B=E5=A2=9E=E5=8A=A0=E6=8B=93=E6=81=92=E4=BA=91003-FM?= =?UTF-8?q?=E7=B3=BB=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceAirTypeGeneralEnumController.java | 30 +++++++++++-------- ...V5__Create_air_type_general_enum_table.sql | 8 +++-- 2 files changed, 23 insertions(+), 15 deletions(-) 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, '-');