27 lines
674 B
Go
27 lines
674 B
Go
|
// 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
|
||
|
}
|