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

34 lines
1.1 KiB
Go
Executable File

// Code generated by goctl. DO NOT EDIT.
package model
import (
"context"
"fmt"
"strings"
)
func (m *defaultFsProductTemplateV2Model) FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error) {
query := fmt.Sprintf("select %s from %s where `id` in (?) and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table)
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 0, 1); err != nil {
return nil, err
}
return
}
func (m *defaultFsProductTemplateV2Model) FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error) {
if len(modelIds) == 0 {
return
}
query := fmt.Sprintf("select %s from %s where `model_id` in (?) and `product_id` = ? and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table)
switch sort {
case 1:
query = fmt.Sprintf("%s order by `sort` ASC", query)
case 2:
query = fmt.Sprintf("%s order by `sort` DESC", query)
}
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), productId, 0, 1); err != nil {
return nil, err
}
return
}