Merge branch 'main' of http://th.local.t-aaron.com:13000/THENG/a-tuoheng-device
This commit is contained in:
commit
81242c6ef5
|
|
@ -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,12 +17,14 @@ 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
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author 拓恒
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
@RestController
|
||||
|
|
@ -48,7 +51,6 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
List<AirTypeGeneralEnumVO> voList = DeviceAirTypeGeneralEnumVOConvert.fromList(list);
|
||||
return R.ok(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按厂商分组查询无人机类型
|
||||
*
|
||||
|
|
@ -91,5 +93,71 @@ public class DeviceAirTypeGeneralEnumController extends BaseController
|
|||
|
||||
return R.ok(vendorGroupList);
|
||||
}
|
||||
/**
|
||||
* 按厂商分组查询无人机类型(厂商 -> 分类 -> 设备类型)
|
||||
*
|
||||
* @return 按厂商分组的无人机类型列表
|
||||
*/
|
||||
@GetMapping("/vendorGroupNew")
|
||||
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendorNew()
|
||||
{
|
||||
// 从数据字典获取无人机厂商类型
|
||||
R<List<SysDictData>> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER);
|
||||
List<AirTypeVendorGroupVO> vendorGroupList = new ArrayList<>();
|
||||
|
||||
if (dictResult.getData() != null)
|
||||
{
|
||||
// 获取所有无人机类型数据(包括生效和失效的)
|
||||
List<DeviceAirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new DeviceAirTypeGeneralEnumDTO());
|
||||
List<AirTypeGeneralEnumVO> allVoList = DeviceAirTypeGeneralEnumVOConvert.fromList(allList);
|
||||
|
||||
// 为每个字典项创建分组
|
||||
for (SysDictData dictData : dictResult.getData())
|
||||
{
|
||||
AirTypeVendorGroupVO groupVO = new AirTypeVendorGroupVO();
|
||||
groupVO.setLabel(dictData.getDictLabel());
|
||||
groupVO.setValue(dictData.getDictValue());
|
||||
|
||||
// 筛选属于当前厂商的无人机类型
|
||||
List<AirTypeGeneralEnumVO> vendorAirTypes = new ArrayList<>();
|
||||
for (AirTypeGeneralEnumVO vo : allVoList)
|
||||
{
|
||||
if (dictData.getDictValue().equals(vo.getVendorId().toString()))
|
||||
{
|
||||
vendorAirTypes.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
// 按分类分组
|
||||
Map<String, List<AirTypeGeneralEnumVO>> 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<AirTypeCategoryGroupVO> categoryGroups = new ArrayList<>();
|
||||
for (Map.Entry<String, List<AirTypeGeneralEnumVO>> 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public interface IDeviceAirTypeGeneralEnumDomain
|
|||
* 批量删除无人机类型通用枚举
|
||||
*
|
||||
* @param ids 需要删除的主键集合
|
||||
* @return 结果
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteAirTypeGeneralEnumByIds(Long[] ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,11 @@ public class DeviceAirTypeGeneralEnum extends BaseEntity
|
|||
/** 图标 */
|
||||
private String icon;
|
||||
|
||||
/** 分类 */
|
||||
private String category;
|
||||
|
||||
/** 是否生效:0-失效,1-生效 */
|
||||
private Integer enabled;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 +
|
||||
|
|
|
|||
|
|
@ -41,4 +41,10 @@ public class DeviceAirTypeGeneralEnumDTO extends BaseEntity
|
|||
/** 图标 */
|
||||
private String icon;
|
||||
|
||||
/** 分类 */
|
||||
private String category;
|
||||
|
||||
/** 是否生效:0-失效,1-生效 */
|
||||
private Integer enabled;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, '-');
|
||||
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, '-');
|
||||
|
|
@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="com.ruoyi.device.mapper.entity.DeviceAirTypeGeneralEnumEntity" id="AirTypeGeneralEnumResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="category" column="category" />
|
||||
<result property="enabled" column="enabled" />
|
||||
<result property="vendorId" column="vendor_id" />
|
||||
<result property="domain" column="domain" />
|
||||
<result property="type" column="type" />
|
||||
|
|
@ -20,19 +22,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAirTypeGeneralEnumVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectAirTypeGeneralEnumById" parameterType="Long" resultMap="AirTypeGeneralEnumResult">
|
||||
<include refid="selectAirTypeGeneralEnumVo"/>
|
||||
where id = #{id}
|
||||
where id = #{id} and enabled = 1
|
||||
</select>
|
||||
|
||||
<select id="selectAirTypeGeneralEnumList" parameterType="com.ruoyi.device.mapper.entity.DeviceAirTypeGeneralEnumEntity" resultMap="AirTypeGeneralEnumResult">
|
||||
<include refid="selectAirTypeGeneralEnumVo"/>
|
||||
<where>
|
||||
enabled = 1
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
|
|
@ -55,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into device_air_type_general_enum
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="category != null and category != ''">category,</if>
|
||||
<if test="enabled != null">enabled,</if>
|
||||
<if test="vendorId != null">vendor_id,</if>
|
||||
<if test="domain != null">domain,</if>
|
||||
<if test="type != null">type,</if>
|
||||
|
|
@ -66,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="category != null and category != ''">#{category},</if>
|
||||
<if test="enabled != null">#{enabled},</if>
|
||||
<if test="vendorId != null">#{vendorId},</if>
|
||||
<if test="domain != null">#{domain},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
|
|
@ -81,6 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update device_air_type_general_enum
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="category != null and category != ''">category = #{category},</if>
|
||||
<if test="enabled != null">enabled = #{enabled},</if>
|
||||
<if test="vendorId != null">vendor_id = #{vendorId},</if>
|
||||
<if test="domain != null">domain = #{domain},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue