fusenapi/model/self_fsproductpricemodel.go

27 lines
674 B
Go
Raw Normal View History

2023-06-06 05:07:39 +00:00
// Code generated by goctl. DO NOT EDIT.
package model
import (
"context"
"fmt"
"strings"
)
type GetPriceListRsp struct {
ProductId int64 `json:"product_id"`
Price string `json:"price"`
}
func (m *defaultFsProductPriceModel) GetPriceList(ctx context.Context, productIds []string) (resp []GetPriceListRsp, err error) {
if len(productIds) == 0 {
return nil, nil
}
query := fmt.Sprintf("select %s from %s where `product_id` in (?) and `status` = ? group by product_id", "product_id,group_concat(step_price) as price ", m.table)
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 1); err != nil {
return nil, err
}
return
}