diff --git a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go index 4f2c4dd..f74f358 100644 --- a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go +++ b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go @@ -6,6 +6,7 @@ import ( "tydata-server/app/main/api/internal/svc" "tydata-server/app/main/api/internal/types" "tydata-server/app/main/model" + "tydata-server/common/tool" "tydata-server/common/xerr" "tydata-server/pkg/lzkit/crypto" @@ -51,11 +52,13 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR for _, c := range closures { ids = append(ids, c.DescendantId) } + // 将int64切片转换为interface{}切片,以便squirrel正确处理IN查询 interfaceIds := make([]interface{}, len(ids)) for i, id := range ids { interfaceIds[i] = id } - builder = builder.Where("id IN (?)", interfaceIds...) + // 使用项目中的InPlaceholders函数生成正确数量的占位符 + builder = builder.Where("id IN ("+tool.InPlaceholders(len(interfaceIds))+")", interfaceIds...) } agents, total, err := l.svcCtx.AgentModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "id DESC")