diff --git a/backend/__debug_bin961456679 b/backend/__debug_bin1230854055 similarity index 94% rename from backend/__debug_bin961456679 rename to backend/__debug_bin1230854055 index 94df6e2..6603d7e 100755 Binary files a/backend/__debug_bin961456679 and b/backend/__debug_bin1230854055 differ diff --git a/backend/modules/medias/service.go b/backend/modules/medias/service.go index a36c9d4..d795874 100644 --- a/backend/modules/medias/service.go +++ b/backend/modules/medias/service.go @@ -111,36 +111,38 @@ func (svc *Service) List(ctx context.Context, tenantId, userId int64, filter *Li tbl := table.Medias stmt := tbl. SELECT(tbl.AllColumns). - WHERE(tbl.TenantID.EQ(Int(tenantId))). ORDER_BY(tbl.ID.DESC()) + cond := tbl.TenantID.EQ(Int(tenantId)) if filter.Title != nil && *filter.Title != "" { - stmt = stmt.WHERE(tbl.Title.LIKE(String("%" + *filter.Title + "%"))) + cond = cond.AND(tbl.Title.LIKE(String("%" + *filter.Title + "%"))) } if filter.Bought != nil && *filter.Bought { if len(boughtIDs) > 0 { - stmt = stmt. - WHERE(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression { + cond = cond. + AND(tbl.ID.IN(lo.Map(boughtIDs, func(item int64, _ int) Expression { return Int(item) })...)) } } else { - stmt = stmt.WHERE(tbl.Publish.EQ(Bool(true))) + cond = cond.AND(tbl.Publish.EQ(Bool(true))) } if filter.OffsetID > 0 { if filter.Action == 0 { - stmt = stmt.WHERE(tbl.ID.LT(Int(filter.OffsetID))) + cond = cond.AND(tbl.ID.LT(Int(filter.OffsetID))) stmt = stmt.LIMIT(10) } if filter.Action == 1 { - stmt = stmt.WHERE(tbl.ID.GT(Int(filter.OffsetID))) + cond = cond.AND(tbl.ID.GT(Int(filter.OffsetID))) } } else { stmt = stmt.LIMIT(10) } + + stmt = stmt.WHERE(cond) log.Debug(stmt.DebugSql()) var dest []model.Medias diff --git a/frontend/src/components/ChargeCode.vue b/frontend/src/components/ChargeCode.vue index c9976b0..585a761 100644 --- a/frontend/src/components/ChargeCode.vue +++ b/frontend/src/components/ChargeCode.vue @@ -1,5 +1,8 @@ diff --git a/frontend/src/components/List.vue b/frontend/src/components/List.vue index fd2717e..5ec5e26 100644 --- a/frontend/src/components/List.vue +++ b/frontend/src/components/List.vue @@ -1,9 +1,8 @@