From 87d7de414e549b9e29fe0eeafea5ba80177be351 Mon Sep 17 00:00:00 2001 From: gyb Date: Mon, 9 Feb 2026 13:44:02 +0800 Subject: [PATCH] =?UTF-8?q?fit:=E8=AE=BE=E5=A4=87=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=EF=BC=8C=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceAirTypeGeneralEnumController.java | 37 +++++++++++-- .../api/IDeviceAirTypeGeneralEnumDomain.java | 2 +- .../model/DeviceAirTypeGeneralEnum.java | 6 +++ .../DeviceAirTypeGeneralEnumEntity.java | 12 +++++ .../dto/DeviceAirTypeGeneralEnumDTO.java | 6 +++ ...V5__Create_air_type_general_enum_table.sql | 54 ++++++++++--------- .../device/DeviceAirTypeGeneralEnumMapper.xml | 13 ++++- 7 files changed, 96 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java b/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java index 8e40576..1b2f8ed 100644 --- a/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java +++ b/src/main/java/com/ruoyi/device/controller/DeviceAirTypeGeneralEnumController.java @@ -3,6 +3,7 @@ package com.ruoyi.device.controller; import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.device.api.domain.AirTypeCategoryGroupVO; import com.ruoyi.device.api.domain.AirTypeGeneralEnumVO; import com.ruoyi.device.api.domain.AirTypeVendorGroupVO; import com.ruoyi.device.controller.convert.DeviceAirTypeGeneralEnumVOConvert; @@ -16,7 +17,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 无人机类型通用枚举Controller @@ -50,7 +53,7 @@ public class DeviceAirTypeGeneralEnumController extends BaseController } /** - * 按厂商分组查询无人机类型 + * 按厂商分组查询无人机类型(厂商 -> 分类 -> 设备类型) * * @return 按厂商分组的无人机类型列表 */ @@ -63,9 +66,9 @@ public class DeviceAirTypeGeneralEnumController extends BaseController if (dictResult.getData() != null) { - // 获取所有无人机类型数据 - List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO()); - List allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList); + // 获取所有无人机类型数据(包括生效和失效的) + List allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO()); + List allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList); // 为每个字典项创建分组 for (SysDictData dictData : dictResult.getData()) @@ -84,12 +87,36 @@ public class DeviceAirTypeGeneralEnumController extends BaseController } } - groupVO.setAirTypeList(vendorAirTypes); + // 按分类分组 + Map> categoryMap = new HashMap<>(); + for (AirTypeGeneralEnumVO vo : vendorAirTypes) + { + String category = vo.getCategory(); + if (category == null || category.isEmpty()) { + category = "其他"; + } + if (!categoryMap.containsKey(category)) { + categoryMap.put(category, new ArrayList<>()); + } + categoryMap.get(category).add(vo); + } + + // 构建分类分组列表 + List categoryGroups = new ArrayList<>(); + for (Map.Entry> entry : categoryMap.entrySet()) { + AirTypeCategoryGroupVO categoryGroup = new AirTypeCategoryGroupVO(); + categoryGroup.setCategory(entry.getKey()); + categoryGroup.setAirTypeList(entry.getValue()); + categoryGroups.add(categoryGroup); + } + + groupVO.setCategoryGroups(categoryGroups); vendorGroupList.add(groupVO); } } return R.ok(vendorGroupList); } + } diff --git a/src/main/java/com/ruoyi/device/domain/api/IDeviceAirTypeGeneralEnumDomain.java b/src/main/java/com/ruoyi/device/domain/api/IDeviceAirTypeGeneralEnumDomain.java index 4c3bfb6..b1c5d0d 100644 --- a/src/main/java/com/ruoyi/device/domain/api/IDeviceAirTypeGeneralEnumDomain.java +++ b/src/main/java/com/ruoyi/device/domain/api/IDeviceAirTypeGeneralEnumDomain.java @@ -55,7 +55,7 @@ public interface IDeviceAirTypeGeneralEnumDomain * 批量删除无人机类型通用枚举 * * @param ids 需要删除的主键集合 - * @return 结果 + * @return 影响行数 */ int deleteAirTypeGeneralEnumByIds(Long[] ids); } diff --git a/src/main/java/com/ruoyi/device/domain/model/DeviceAirTypeGeneralEnum.java b/src/main/java/com/ruoyi/device/domain/model/DeviceAirTypeGeneralEnum.java index b92eba1..3731cc7 100644 --- a/src/main/java/com/ruoyi/device/domain/model/DeviceAirTypeGeneralEnum.java +++ b/src/main/java/com/ruoyi/device/domain/model/DeviceAirTypeGeneralEnum.java @@ -41,5 +41,11 @@ public class DeviceAirTypeGeneralEnum extends BaseEntity /** 图标 */ private String icon; + /** 分类 */ + private String category; + + /** 是否生效:0-失效,1-生效 */ + private Integer enabled; + } diff --git a/src/main/java/com/ruoyi/device/mapper/entity/DeviceAirTypeGeneralEnumEntity.java b/src/main/java/com/ruoyi/device/mapper/entity/DeviceAirTypeGeneralEnumEntity.java index 1356608..6010a14 100644 --- a/src/main/java/com/ruoyi/device/mapper/entity/DeviceAirTypeGeneralEnumEntity.java +++ b/src/main/java/com/ruoyi/device/mapper/entity/DeviceAirTypeGeneralEnumEntity.java @@ -48,12 +48,24 @@ public class DeviceAirTypeGeneralEnumEntity extends BaseEntity { */ private String icon; + /** + * 分类 + */ + private String category; + + /** + * 是否生效:0-失效,1-生效 + */ + private Integer enabled; + @Override public String toString() { return "DeviceAirTypeGeneralEnumEntity{" + "id=" + id + ", name='" + name + "'" + + ", category='" + category + "'" + + ", enabled=" + enabled + ", vendorId=" + vendorId + ", domain=" + domain + ", type=" + type + diff --git a/src/main/java/com/ruoyi/device/service/dto/DeviceAirTypeGeneralEnumDTO.java b/src/main/java/com/ruoyi/device/service/dto/DeviceAirTypeGeneralEnumDTO.java index 77dcffd..2dafb58 100644 --- a/src/main/java/com/ruoyi/device/service/dto/DeviceAirTypeGeneralEnumDTO.java +++ b/src/main/java/com/ruoyi/device/service/dto/DeviceAirTypeGeneralEnumDTO.java @@ -41,4 +41,10 @@ public class DeviceAirTypeGeneralEnumDTO extends BaseEntity /** 图标 */ private String icon; + /** 分类 */ + private String category; + + /** 是否生效:0-失效,1-生效 */ + private Integer enabled; + } 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 ebbcf32..682a5c9 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 @@ -3,6 +3,8 @@ CREATE TABLE IF NOT EXISTS `device_air_type_general_enum` ( `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键', `name` VARCHAR(255) DEFAULT NULL COMMENT '名称', + `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 '领域', `type` BIGINT DEFAULT NULL COMMENT '主类型', @@ -18,37 +20,37 @@ CREATE TABLE IF NOT EXISTS `device_air_type_general_enum` ( -- Matrice 系列 -INSERT INTO device_air_type_general_enum (name, vendor_id, domain, type, sub_type, remark) VALUES - ('Matrice 400', 1, 0, 103, 0, '-'), - ('Matrice 350 RTK', 1, 0, 89, 0, '-'), - ('Matrice 300 RTK', 1, 0, 60, 0, '-'), - ('Matrice 30', 1, 0, 67, 0, '-'), - ('Matrice 30T', 1, 0, 67, 1, '-'), - ('Matrice 3D', 1, 0, 91, 0, '-'), - ('Matrice 3TD', 1, 0, 91, 1, '-'), - ('Matrice 4D', 1, 0, 100, 0, '-'), - ('Matrice 4TD', 1, 0, 100, 1, '-'); +INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES + ('Matrice 400', 'Matrice', 1, 1, 0, 103, 0, '-'), + ('Matrice 350 RTK', 'Matrice', 1, 1, 0, 89, 0, '-'), + ('Matrice 300 RTK', 'Matrice', 1, 1, 0, 60, 0, '-'), + ('Matrice 30', 'Matrice', 1, 1, 0, 67, 0, '-'), + ('Matrice 30T', 'Matrice', 1, 1, 0, 67, 1, '-'), + ('Matrice 3D', 'Matrice', 1, 1, 0, 91, 0, '-'), + ('Matrice 3TD', 'Matrice', 1, 1, 0, 91, 1, '-'), + ('Matrice 4D', 'Matrice', 1, 1, 0, 100, 0, '-'), + ('Matrice 4TD', 'Matrice', 1, 1, 0, 100, 1, '-'); -- Mavic 3 行业系列 -INSERT INTO device_air_type_general_enum (name, vendor_id, domain, type, sub_type, remark) VALUES - ('Mavic 3 行业系列 (M3E 相机)', 1, 0, 77, 0, '-'), - ('Mavic 3 行业系列 (M3T 相机)', 1, 0, 77, 1, '-'), - ('Mavic 3 行业系列 (M3TA 相机)', 1, 0, 77, 3, '-'); +INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES + ('Mavic 3 行业系列 (M3E 相机)', 'Mavic', 0, 1, 0, 77, 0, '-'), + ('Mavic 3 行业系列 (M3T 相机)', 'Mavic', 0, 1, 0, 77, 1, '-'), + ('Mavic 3 行业系列 (M3TA 相机)', 'Mavic', 0, 1, 0, 77, 3, '-'); -- DJI Matrice 4 系列 -INSERT INTO device_air_type_general_enum (name, vendor_id, domain, type, sub_type, remark) VALUES - ('DJI Matrice 4 系列 (M4E 相机)', 1, 0, 99, 0, '-'), - ('DJI Matrice 4 系列 (M4T 相机)', 1, 0, 99, 1, '-'); +INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES + ('DJI Matrice 4 系列 (M4E 相机)', 'Matrice', 0, 1, 0, 99, 0, '-'), + ('DJI Matrice 4 系列 (M4T 相机)', 'Matrice', 0, 1, 0, 99, 1, '-'); -- 遥控器系列 -INSERT INTO device_air_type_general_enum (name, vendor_id, domain, type, sub_type, remark) VALUES - ('DJI 带屏遥控器行业版', 1, 2, 56, 0, '搭配 Matrice 300 RTK'), - ('DJI RC Plus', 1, 2, 119, 0, '搭配 Matrice 350 RTK,Matrice 300 RTK,Matrice 30/30T'), - ('DJI RC Plus 2', 1, 2, 174, 0, '搭配 >DJI Matrice 4 系列'), - ('DJI RC Pro 行业版', 1, 2, 144, 0, '搭配 Mavic 3 行业系列'); +INSERT INTO device_air_type_general_enum (name, category, enabled, vendor_id, domain, type, sub_type, remark) VALUES + ('DJI 带屏遥控器行业版', '遥控器', 0, 1, 2, 56, 0, '搭配 Matrice 300 RTK'), + ('DJI RC Plus', '遥控器', 0, 1, 2, 119, 0, '搭配 Matrice 350 RTK,Matrice 300 RTK,Matrice 30/30T'), + ('DJI RC Plus 2', '遥控器', 0, 1, 2, 174, 0, '搭配 >DJI Matrice 4 系列'), + ('DJI RC Pro 行业版', '遥控器', 0, 1, 2, 144, 0, '搭配 Mavic 3 行业系列'); -- 大疆机场系列 -INSERT INTO device_air_type_general_enum (name, vendor_id, domain, type, sub_type, remark) VALUES - ('大疆机场', 1, 3, 1, 0, '-'), - ('大疆机场 2', 1, 3, 2, 0, '-'), - ('大疆机场 3', 1, 3, 3, 0, '-'); \ No newline at end of file +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 diff --git a/src/main/resources/mapper/device/DeviceAirTypeGeneralEnumMapper.xml b/src/main/resources/mapper/device/DeviceAirTypeGeneralEnumMapper.xml index 22b59ea..6b5d143 100644 --- a/src/main/resources/mapper/device/DeviceAirTypeGeneralEnumMapper.xml +++ b/src/main/resources/mapper/device/DeviceAirTypeGeneralEnumMapper.xml @@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -20,19 +22,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, name, vendor_id, domain, type, sub_type, icon, + select id, name, category, enabled, vendor_id, domain, type, sub_type, icon, create_by, create_time, update_by, update_time, remark from device_air_type_general_enum