package xiaozhi.modules.agent.service; import java.util.List; import java.util.Map; import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; import xiaozhi.modules.agent.dto.AgentCreateDTO; import xiaozhi.modules.agent.dto.AgentDTO; import xiaozhi.modules.agent.dto.AgentMemoryDTO; import xiaozhi.modules.agent.dto.AgentUpdateDTO; import xiaozhi.modules.agent.entity.AgentEntity; import xiaozhi.modules.agent.vo.AgentInfoVO; /** * 智能体表处理service * * @author Goody * @version 1.0, 2025/4/30 * @since 1.0.0 */ public interface AgentService extends BaseService { /** * 获取管理员智能体列表 * * @param params 查询参数 * @return 分页数据 */ PageData adminAgentList(Map params); /** * 根据ID获取智能体 * * @param id 智能体ID * @return 智能体实体 */ AgentInfoVO getAgentById(String id); /** * 根据ID获取当前用户有权访问的智能体 * * @param id 智能体ID * @param userId 当前用户ID * @return 智能体实体 */ AgentInfoVO getAgentById(String id, Long userId); /** * 插入智能体 * * @param entity 智能体实体 * @return 是否成功 */ boolean insert(AgentEntity entity); /** * 根据用户ID删除智能体 * * @param userId 用户ID */ void deleteAgentByUserId(Long userId); /** * 删除智能体及其关联数据 * * @param agentId 智能体ID */ void deleteAgent(String agentId); /** * 获取用户智能体列表 * * @param userId 用户ID * @param keyword 搜索关键词 * @param searchType 搜索类型(name - 按名称搜索,mac - 按MAC地址搜索) * @return 智能体列表 */ List getUserAgents(Long userId, String keyword, String searchType); /** * 根据智能体ID获取设备数量 * * @param agentId 智能体ID * @return 设备数量 */ Integer getDeviceCountByAgentId(String agentId); /** * 根据设备MAC地址查询对应设备的默认智能体信息 * * @param macAddress 设备MAC地址 * @return 默认智能体信息,不存在时返回null */ AgentEntity getDefaultAgentByMacAddress(String macAddress); /** * 检查用户是否有权限访问智能体 * * @param agentId 智能体ID * @param userId 用户ID * @return 是否有权限 */ boolean checkAgentPermission(String agentId, Long userId); /** * 更新智能体 * * @param agentId 智能体ID * @param dto 更新智能体所需的信息 */ void updateAgentById(String agentId, AgentUpdateDTO dto); /** * 更新当前用户有权访问的智能体 * * @param agentId 智能体ID * @param dto 更新智能体所需的信息 * @param userId 当前用户ID */ void updateAgentById(String agentId, AgentUpdateDTO dto, Long userId); /** * 根据设备MAC地址更新当前用户有权访问的智能体记忆 * * @param macAddress 设备MAC地址 * @param dto 智能体记忆 * @param userId 当前用户ID */ void updateAgentMemoryByDeviceMacAddress(String macAddress, AgentMemoryDTO dto, Long userId); /** * 删除当前用户有权访问的智能体 * * @param agentId 智能体ID * @param userId 当前用户ID */ void deleteAgentById(String agentId, Long userId); /** * 更新智能体 * * @param agentId 智能体ID * @param dto 更新智能体所需的信息 * @param createSnapshot 是否创建配置快照 */ void updateAgentById(String agentId, AgentUpdateDTO dto, boolean createSnapshot); /** * 创建智能体 * * @param dto 创建智能体所需的信息 * @return 创建的智能体ID */ String createAgent(AgentCreateDTO dto); }