搜索拓展

This commit is contained in:
LJH-rgsze
2026-01-04 16:53:38 +08:00
parent a2023a65c0
commit 9b6620dd4a
4 changed files with 32 additions and 1 deletions
@@ -1,6 +1,7 @@
package xiaozhi.modules.agent.dto;
import java.util.Date;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -45,4 +46,7 @@ public class AgentDTO {
@Schema(description = "设备数量", example = "10")
private Integer deviceCount;
@Schema(description = "关联设备的MAC地址列表", example = "[\"00:11:22:33:44:55\", \"66:77:88:99:AA:BB\"]")
private List<String> macAddresses;
}
@@ -42,6 +42,7 @@ import xiaozhi.modules.agent.service.AgentPluginMappingService;
import xiaozhi.modules.agent.service.AgentService;
import xiaozhi.modules.agent.service.AgentTemplateService;
import xiaozhi.modules.agent.vo.AgentInfoVO;
import xiaozhi.modules.device.entity.DeviceEntity;
import xiaozhi.modules.device.service.DeviceService;
import xiaozhi.modules.model.dto.ModelProviderDTO;
import xiaozhi.modules.model.dto.VoiceDTO;
@@ -157,6 +158,15 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
// 获取设备数量
dto.setDeviceCount(getDeviceCountByAgentId(agent.getId()));
// 获取关联设备的MAC地址列表
List<DeviceEntity> devices = deviceService.getUserDevices(agent.getUserId(), agent.getId());
List<String> macAddresses = devices.stream()
.map(DeviceEntity::getMacAddress)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
dto.setMacAddresses(macAddresses);
return dto;
}).collect(Collectors.toList());
}
+9
View File
@@ -11096,6 +11096,15 @@
"node": ">= 0.4.0"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+9 -1
View File
@@ -136,7 +136,15 @@ export default {
}
this.devices = this.originalDevices.filter(device => {
return this.searchRegex.test(device.agentName);
// 搜索智能体名称
if (this.searchRegex.test(device.agentName)) {
return true;
}
// 搜索关联设备的MAC地址
if (device.macAddresses && device.macAddresses.length > 0) {
return device.macAddresses.some(macAddress => this.searchRegex.test(macAddress));
}
return false;
});
},
// 搜索更新智能体列表