fit:增加无人机厂商分组接口

This commit is contained in:
高大 2026-01-29 16:58:20 +08:00
parent d3db54776d
commit 48b87722d6
8 changed files with 194 additions and 206 deletions

View File

@ -0,0 +1,35 @@
package com.ruoyi.device.api.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 无人机厂商分组VO
*
* @author ruoyi
* @date 2026-01-29
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AirTypeVendorGroupVO extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 厂商标签
*/
private String label;
/**
* 厂商值
*/
private String value;
/**
* 无人机类型列表
*/
private List<AirTypeGeneralEnumVO> airTypeList;
}

View File

@ -1,13 +1,17 @@
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.AirTypeGeneralEnumVO;
import com.ruoyi.device.api.domain.AirTypeVendorGroupVO;
import com.ruoyi.device.api.domain.DockVO;
import com.ruoyi.device.controller.convert.AirTypeGeneralEnumVOConvert;
import com.ruoyi.device.controller.convert.DockVOConvert;
import com.ruoyi.device.service.api.IAirTypeGeneralEnumService;
import com.ruoyi.device.service.dto.AirTypeGeneralEnumDTO;
import com.ruoyi.system.api.RemoteDictService;
import com.ruoyi.system.api.domain.SysDictData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -15,7 +19,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 无人机类型通用枚举Controller
@ -24,12 +31,15 @@ import java.util.List;
* @date 2026-01-28
*/
@RestController
@RequestMapping("/air-type-general-enum")
@RequestMapping("/airType/generalEnum")
public class AirTypeGeneralEnumController extends BaseController
{
@Autowired
private IAirTypeGeneralEnumService airTypeGeneralEnumService;
@Autowired
private RemoteDictService remoteDictService;
/**
* 查询无人机类型通用枚举列表
*
@ -44,4 +54,48 @@ public class AirTypeGeneralEnumController extends BaseController
List<AirTypeGeneralEnumVO> voList = AirTypeGeneralEnumVOConvert.fromList(list);
return R.ok(voList);
}
/**
* 按厂商分组查询无人机类型
*
* @return 按厂商分组的无人机类型列表
*/
@GetMapping("/vendorGroup")
public R<List<AirTypeVendorGroupVO>> selectAirTypeGeneralEnumGroupByVendor()
{
// 从数据字典获取无人机厂商类型
R<List<SysDictData>> dictResult = remoteDictService.getDictDataByType("air_vendor_type", SecurityConstants.INNER);
List<AirTypeVendorGroupVO> vendorGroupList = new ArrayList<>();
if (dictResult.getData() != null)
{
// 获取所有无人机类型数据
List<AirTypeGeneralEnumDTO> allList = airTypeGeneralEnumService.selectAirTypeGeneralEnumList(new AirTypeGeneralEnumDTO());
List<AirTypeGeneralEnumVO> allVoList = AirTypeGeneralEnumVOConvert.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);
}
}
groupVO.setAirTypeList(vendorAirTypes);
vendorGroupList.add(groupVO);
}
}
return R.ok(vendorGroupList);
}
}

View File

@ -26,140 +26,20 @@ public class AirTypeGeneralEnum extends BaseEntity
/** 名称 */
private String name;
/** 厂商ID */
private Long vendorId;
/** 领域 */
private String domain;
private Long domain;
/** 主类型 */
private String type;
private Long type;
/** 子类型 */
private String sub_type;
private Long subType;
/** 图标 */
private String icon;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateTime;
/** 备注 */
private String remark;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getDomain()
{
return domain;
}
public void setDomain(String domain)
{
this.domain = domain;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getSub_type()
{
return sub_type;
}
public void setSub_type(String sub_type)
{
this.sub_type = sub_type;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public String getUpdateBy()
{
return updateBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
}

View File

@ -5,7 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 无人机表实体对象 device_aircraft
* 无人机类型通用枚举表实体对象 air_type_general_enum
* Mapper 层实体对应数据库表
*
* @author ruoyi
@ -26,18 +26,23 @@ public class AirTypeGeneralEnumEntity extends BaseEntity {
*/
private String name;
/**
* 厂商ID
*/
private Long vendorId;
/**
* 领域
*/
private String domain;
private Long domain;
/**
* 主类型
*/
private String type;
private Long type;
/**
* 子类型
*/
private String sub_type;
private Long subType;
/**
* 图标
*/
@ -46,13 +51,14 @@ public class AirTypeGeneralEnumEntity extends BaseEntity {
@Override
public String toString() {
return "AircraftEntity{" +
"aircraftId=" + id +
return "AirTypeGeneralEnumEntity{" +
"id=" + id +
", name='" + name + '\'' +
", domain='" + domain + '\'' +
", type='" + type + '\'' +
", vendorId=" + vendorId +
", domain=" + domain +
", type=" + type +
", icon='" + icon + '\'' +
", sub_type=" + sub_type +
", subType=" + subType +
'}';
}
}

View File

@ -26,14 +26,17 @@ public class AirTypeGeneralEnumDTO extends BaseEntity
/** 名称 */
private String name;
/** 厂商ID */
private Long vendorId;
/** 领域 */
private String domain;
private Long domain;
/** 主类型 */
private String type;
private Long type;
/** 子类型 */
private String sub_type;
private Long subType;
/** 图标 */
private String icon;

View File

@ -1,51 +0,0 @@
CREATE TABLE IF NOT EXISTS `air_type_general_enum` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` VARCHAR(255) DEFAULT NULL COMMENT '名称',
`domain` VARCHAR(255) DEFAULT NULL COMMENT '领域',
`type` VARCHAR(255) DEFAULT NULL COMMENT '主类型',
`sub_type` VARCHAR(255) DEFAULT NULL COMMENT '子类型',
`icon` VARCHAR(255) DEFAULT NULL COMMENT '图标',
`create_by` VARCHAR(64) DEFAULT '' COMMENT '创建者',
`create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
`update_by` VARCHAR(64) DEFAULT '' COMMENT '更新者',
`update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
`remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='无人机类型通用枚举表';
-- Matrice 系列
INSERT INTO air_type_general_enum (name, domain, type, sub_type, remark) VALUES
('Matrice 400', '0', '103', '0', '-'),
('Matrice 350 RTK', '0', '89', '0', '-'),
('Matrice 300 RTK', '0', '60', '0', '-'),
('Matrice 30', '0', '67', '0', '-'),
('Matrice 30T', '0', '67', '1', '-'),
('Matrice 3D', '0', '91', '0', '-'),
('Matrice 3TD', '0', '91', '1', '-'),
('Matrice 4D', '0', '100', '0', '-'),
('Matrice 4TD', '0', '100', '1', '-');
-- Mavic 3 行业系列
INSERT INTO air_type_general_enum (name, domain, type, sub_type, remark) VALUES
('Mavic 3 行业系列 (M3E 相机)', '0', '77', '0', '-'),
('Mavic 3 行业系列 (M3T 相机)', '0', '77', '1', '-'),
('Mavic 3 行业系列 (M3TA 相机)', '0', '77', '3', '-');
-- DJI Matrice 4 系列
INSERT INTO air_type_general_enum (name, domain, type, sub_type, remark) VALUES
('DJI Matrice 4 系列 (M4E 相机)', '0', '99', '0', '-'),
('DJI Matrice 4 系列 (M4T 相机)', '0', '99', '1', '-');
-- 遥控器系列
INSERT INTO air_type_general_enum (name, domain, type, sub_type, remark) VALUES
('DJI 带屏遥控器行业版', '2', '56', '0', '搭配 Matrice 300 RTK'),
('DJI RC Plus', '2', '119', '0', '搭配 Matrice 350 RTK,Matrice 300 RTK,Matrice 30/30T'),
('DJI RC Plus 2', '2', '174', '0', '搭配 >DJI Matrice 4 系列'),
('DJI RC Pro 行业版', '2', '144', '0', '搭配 Mavic 3 行业系列');
-- 大疆机场系列
INSERT INTO air_type_general_enum (name, domain, type, sub_type, remark) VALUES
('大疆机场', '3', '1', '0', '-'),
('大疆机场 2', '3', '2', '0', '-'),
('大疆机场 3', '3', '3', '0', '-');

View File

@ -0,0 +1,54 @@
DROP TABLE IF EXISTS `air_type_general_enum`;
CREATE TABLE IF NOT EXISTS `air_type_general_enum` (
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` VARCHAR(255) DEFAULT NULL COMMENT '名称',
`vendor_id` BIGINT DEFAULT NULL COMMENT '厂商ID',
`domain` BIGINT DEFAULT NULL COMMENT '领域',
`type` BIGINT DEFAULT NULL COMMENT '主类型',
`sub_type` BIGINT DEFAULT NULL COMMENT '子类型',
`icon` VARCHAR(255) DEFAULT NULL COMMENT '图标',
`create_by` VARCHAR(64) DEFAULT '' COMMENT '创建者',
`create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
`update_by` VARCHAR(64) DEFAULT '' COMMENT '更新者',
`update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
`remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='无人机类型通用枚举表';
-- Matrice 系列
INSERT INTO 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, '-');
-- Mavic 3 行业系列
INSERT INTO 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, '-');
-- DJI Matrice 4 系列
INSERT INTO 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 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 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, '-');

View File

@ -7,9 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.ruoyi.device.mapper.entity.AirTypeGeneralEnumEntity" id="AirTypeGeneralEnumResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="vendorId" column="vendor_id" />
<result property="domain" column="domain" />
<result property="type" column="type" />
<result property="sub_type" column="sub_type" />
<result property="subType" column="sub_type" />
<result property="icon" column="icon" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAirTypeGeneralEnumVo">
select id, name, domain, type, sub_type, icon,
select id, name, vendor_id, domain, type, sub_type, icon,
create_by, create_time, update_by, update_time, remark
from air_type_general_enum
</sql>
@ -35,14 +36,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="domain != null and domain != ''">
<if test="vendorId != null">
and vendor_id = #{vendorId}
</if>
<if test="domain != null">
and domain = #{domain}
</if>
<if test="type != null and type != ''">
<if test="type != null">
and type = #{type}
</if>
<if test="sub_type != null and sub_type != ''">
and sub_type = #{sub_type}
<if test="subType != null">
and sub_type = #{subType}
</if>
</where>
</select>
@ -51,9 +55,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into air_type_general_enum
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="domain != null and domain != ''">domain,</if>
<if test="type != null and type != ''">type,</if>
<if test="sub_type != null and sub_type != ''">sub_type,</if>
<if test="vendorId != null">vendor_id,</if>
<if test="domain != null">domain,</if>
<if test="type != null">type,</if>
<if test="subType != null">sub_type,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
@ -61,9 +66,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="domain != null and domain != ''">#{domain},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="sub_type != null and sub_type != ''">#{sub_type},</if>
<if test="vendorId != null">#{vendorId},</if>
<if test="domain != null">#{domain},</if>
<if test="type != null">#{type},</if>
<if test="subType != null">#{subType},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
@ -75,9 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update air_type_general_enum
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="domain != null and domain != ''">domain = #{domain},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="sub_type != null and sub_type != ''">sub_type = #{sub_type},</if>
<if test="vendorId != null">vendor_id = #{vendorId},</if>
<if test="domain != null">domain = #{domain},</if>
<if test="type != null">type = #{type},</if>
<if test="subType != null">sub_type = #{subType},</if>
<if test="icon != null and icon != ''">icon = #{icon},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>