fix: issues

This commit is contained in:
Rogee
2024-12-15 01:48:25 +08:00
parent 5da2894283
commit 77a3bd6af8
3 changed files with 13 additions and 11 deletions

View File

@@ -119,12 +119,13 @@ func (svc *Service) List(ctx context.Context, tenantId, userId int64, filter *Li
}
if filter.Bought != nil && *filter.Bought {
if len(boughtIDs) > 0 {
cond = cond.
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
return Int(item)
})...))
if len(boughtIDs) == 0 {
return []*ListItem{}, nil
}
cond = cond.
AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression {
return Int(item)
})...))
} else {
cond = cond.AND(tbl.Publish.EQ(Bool(true)))
}