fusenapi/model/self_fsproductmodel.go
laodaming 213665eb59 fix
2023-06-06 13:07:39 +08:00

27 lines
723 B
Go
Executable File

// Code generated by goctl. DO NOT EDIT.
package model
import (
"context"
"fmt"
)
func (m *defaultFsProductModel) GetProductListByConditions(ctx context.Context, productType int, isDel int, isShelf int, sort string) (resp []FsProduct, err error) {
query := fmt.Sprintf("select %s from %s where `type` = ? and `is_del` =? and `is_shelf` = ?",
fsProductRows, m.table)
switch sort {
case "sort-asc":
query = fmt.Sprintf("%s order by sort ASC", query)
case "sort-desc":
query = fmt.Sprintf("%s order by sort DESC", query)
default:
query = fmt.Sprintf("%s order by sort DESC", query)
}
err = m.conn.QueryRowsCtx(ctx, &resp, query, productType, isDel, isShelf)
if err != nil {
return nil, err
}
return
}