This commit is contained in:
2025-10-24 13:42:26 +08:00
parent 0068e1053c
commit c72d0a7aa6

View File

@@ -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")