Package com.alibaba.cloud.ai.mapper
Interface AgentDatasourceMapper
- All Superinterfaces:
com.baomidou.mybatisplus.core.mapper.BaseMapper<AgentDatasource>,com.baomidou.mybatisplus.core.mapper.Mapper<AgentDatasource>
@Mapper
public interface AgentDatasourceMapper
extends com.baomidou.mybatisplus.core.mapper.BaseMapper<AgentDatasource>
智能体数据源关联 Mapper 接口
- Author:
- Alibaba Cloud AI
-
Method Summary
Modifier and TypeMethodDescriptionintcountActiveByAgentIdExcluding(Integer agentId, Integer excludeDatasourceId) 统计智能体启用的数据源数量(排除指定数据源)intdisableAllByAgentId(Integer agentId) 禁用智能体的所有数据源selectByAgentId(Integer agentId) 根据智能体ID查询关联的数据源selectByAgentIdAndDatasourceId(Integer agentId, Integer datasourceId) 根据智能体ID和数据源ID查询关联关系selectByAgentIdWithDatasource(Integer agentId) 根据智能体ID查询关联的数据源(包含数据源详细信息)Methods inherited from interface com.baomidou.mybatisplus.core.mapper.BaseMapper
delete, deleteBatchIds, deleteById, deleteById, deleteById, deleteByIds, deleteByIds, deleteByMap, exists, insert, insert, insert, insertOrUpdate, insertOrUpdate, insertOrUpdate, insertOrUpdate, insertOrUpdate, selectBatchIds, selectBatchIds, selectById, selectByIds, selectByIds, selectByMap, selectByMap, selectCount, selectList, selectList, selectList, selectList, selectMaps, selectMaps, selectMaps, selectMaps, selectMapsPage, selectObjs, selectObjs, selectOne, selectOne, selectPage, update, update, updateById, updateById, updateById
-
Method Details
-
selectByAgentIdWithDatasource
@Select("SELECT ad.*, d.name, d.type, d.host, d.port, d.database_name, d.connection_url, d.username, d.password, d.status, d.test_status, d.description FROM agent_datasource ad LEFT JOIN datasource d ON ad.datasource_id = d.id WHERE ad.agent_id = #{agentId} ORDER BY ad.create_time DESC") List<AgentDatasource> selectByAgentIdWithDatasource(@Param("agentId") Integer agentId) 根据智能体ID查询关联的数据源(包含数据源详细信息) -
selectByAgentId
@Select("SELECT * FROM agent_datasource WHERE agent_id = #{agentId} ORDER BY create_time DESC") List<AgentDatasource> selectByAgentId(@Param("agentId") Integer agentId) 根据智能体ID查询关联的数据源 -
selectByAgentIdAndDatasourceId
@Select("SELECT * FROM agent_datasource WHERE agent_id = #{agentId} AND datasource_id = #{datasourceId}") AgentDatasource selectByAgentIdAndDatasourceId(@Param("agentId") Integer agentId, @Param("datasourceId") Integer datasourceId) 根据智能体ID和数据源ID查询关联关系 -
disableAllByAgentId
@Update("UPDATE agent_datasource SET is_active = 0 WHERE agent_id = #{agentId}") int disableAllByAgentId(@Param("agentId") Integer agentId) 禁用智能体的所有数据源 -
countActiveByAgentIdExcluding
@Select("SELECT COUNT(*) FROM agent_datasource WHERE agent_id = #{agentId} AND is_active = 1 AND datasource_id != #{excludeDatasourceId}") int countActiveByAgentIdExcluding(@Param("agentId") Integer agentId, @Param("excludeDatasourceId") Integer excludeDatasourceId) 统计智能体启用的数据源数量(排除指定数据源)
-