// 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 }