fusenapi/model/self_fsproductmodel.go

44 lines
1.3 KiB
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"
)
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
}
2023-06-06 09:18:01 +00:00
func (m *defaultFsProductModel) GetAllProductList(ctx context.Context, isDel int, isShelf int, sort string) (resp []FsProduct, err error) {
query := fmt.Sprintf("select %s from %s where `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, isDel, isShelf)
if err != nil {
return nil, err
}
return
}