fix(region): support distinct sku by name

This commit is contained in:
ioito
2022-09-01 10:31:45 +08:00
parent 85ec1ef5d8
commit 5dd040dd2d
3 changed files with 8 additions and 0 deletions
+3
View File
@@ -83,6 +83,9 @@ type ServerSkuListInput struct {
// 预付费状态
PrepaidStatus string `json:"prepaid_status"`
// 按套餐名称去重
Distinct bool `json:"distinct"`
}
type ElasticcacheSkuListInput struct {
+4
View File
@@ -725,6 +725,10 @@ func (manager *SServerSkuManager) ListItemFilter(
}
}
if query.Distinct {
q = q.GroupBy(q.Field("name"))
}
brands := query.Brands
if len(brands) > 0 {
q = q.Filter(sqlchemy.In(q.Field("brand"), brands))
+1
View File
@@ -28,6 +28,7 @@ type ServerSkusListOptions struct {
PostpaidStatus string `help:"Postpaid status" choices:"soldout|available"`
PrepaidStatus string `help:"Prepaid status" choices:"soldout|available"`
Enabled *bool `help:"Filter enabled skus"`
Distinct bool `help:"distinct sku by name"`
}
func (opts *ServerSkusListOptions) GetId() string {