Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
24
model/fsproductmodel3dlightmodel.go
Executable file
24
model/fsproductmodel3dlightmodel.go
Executable file
@@ -0,0 +1,24 @@
|
||||
package model
|
||||
|
||||
import "github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
|
||||
var _ FsProductModel3dLightModel = (*customFsProductModel3dLightModel)(nil)
|
||||
|
||||
type (
|
||||
// FsProductModel3dLightModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsProductModel3dLightModel.
|
||||
FsProductModel3dLightModel interface {
|
||||
fsProductModel3dLightModel
|
||||
}
|
||||
|
||||
customFsProductModel3dLightModel struct {
|
||||
*defaultFsProductModel3dLightModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsProductModel3dLightModel returns a model for the database table.
|
||||
func NewFsProductModel3dLightModel(conn sqlx.SqlConn) FsProductModel3dLightModel {
|
||||
return &customFsProductModel3dLightModel{
|
||||
defaultFsProductModel3dLightModel: newFsProductModel3dLightModel(conn),
|
||||
}
|
||||
}
|
||||
88
model/fsproductmodel3dlightmodel_gen.go
Executable file
88
model/fsproductmodel3dlightmodel_gen.go
Executable file
@@ -0,0 +1,88 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/builder"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlc"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"github.com/zeromicro/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
var (
|
||||
fsProductModel3dLightFieldNames = builder.RawFieldNames(&FsProductModel3dLight{})
|
||||
fsProductModel3dLightRows = strings.Join(fsProductModel3dLightFieldNames, ",")
|
||||
fsProductModel3dLightRowsExpectAutoSet = strings.Join(stringx.Remove(fsProductModel3dLightFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
|
||||
fsProductModel3dLightRowsWithPlaceHolder = strings.Join(stringx.Remove(fsProductModel3dLightFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
|
||||
)
|
||||
|
||||
type (
|
||||
fsProductModel3dLightModel interface {
|
||||
Insert(ctx context.Context, data *FsProductModel3dLight) (sql.Result, error)
|
||||
FindOne(ctx context.Context, id int64) (*FsProductModel3dLight, error)
|
||||
Update(ctx context.Context, data *FsProductModel3dLight) error
|
||||
Delete(ctx context.Context, id int64) error
|
||||
ListByIds(ctx context.Context, ids []string) (resp []FsProductModel3dLight, err error)
|
||||
}
|
||||
|
||||
defaultFsProductModel3dLightModel struct {
|
||||
conn sqlx.SqlConn
|
||||
table string
|
||||
}
|
||||
|
||||
FsProductModel3dLight struct {
|
||||
Id int64 `db:"id"`
|
||||
Name string `db:"name"` // 灯光名称
|
||||
Info string `db:"info"` // 灯光数据(json格式)
|
||||
Status int64 `db:"status"` // 状态值(1:显示,0:删除)
|
||||
Ctime sql.NullInt64 `db:"ctime"` // 创建时间
|
||||
}
|
||||
)
|
||||
|
||||
func newFsProductModel3dLightModel(conn sqlx.SqlConn) *defaultFsProductModel3dLightModel {
|
||||
return &defaultFsProductModel3dLightModel{
|
||||
conn: conn,
|
||||
table: "`fs_product_model3d_light`",
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) Delete(ctx context.Context, id int64) error {
|
||||
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) FindOne(ctx context.Context, id int64) (*FsProductModel3dLight, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", fsProductModel3dLightRows, m.table)
|
||||
var resp FsProductModel3dLight
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
|
||||
switch err {
|
||||
case nil:
|
||||
return &resp, nil
|
||||
case sqlc.ErrNotFound:
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) Insert(ctx context.Context, data *FsProductModel3dLight) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?)", m.table, fsProductModel3dLightRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.Info, data.Status, data.Ctime)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) Update(ctx context.Context, data *FsProductModel3dLight) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, fsProductModel3dLightRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.Name, data.Info, data.Status, data.Ctime, data.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
@@ -95,14 +95,7 @@ func (m *defaultFsProductModel3dModel) Update(ctx context.Context, data *FsProdu
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.Tag, data.Title, data.Name, data.ModelInfo, data.MaterialId, data.SizeId, data.Sort, data.Light, data.LightList, data.PartId, data.PartList, data.Status, data.Ctime, data.OptionTemplate, data.Price, data.Sku, data.Id)
|
||||
return err
|
||||
}
|
||||
func (m *defaultFsProductModel3dModel) ListBySizeIdsTag(ctx context.Context, sizeIds []string, tag int) (resp []FsProductModel3d, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `size_id` in (?) and `tag` = ?", fsProductModel3dRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(sizeIds, ","), tag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel3dModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ type (
|
||||
Update(ctx context.Context, data *FsProduct) error
|
||||
Delete(ctx context.Context, id int64) error
|
||||
GetProductListByConditions(ctx context.Context, productType int, isDel int, isShelf int, sort string) ([]FsProduct, error)
|
||||
GetAllProductList(ctx context.Context, isDel int, isShelf int, sort string) (resp []FsProduct, err error)
|
||||
}
|
||||
|
||||
defaultFsProductModel struct {
|
||||
@@ -122,24 +123,6 @@ func (m *defaultFsProductModel) Update(ctx context.Context, newData *FsProduct)
|
||||
return err
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
func (m *defaultFsProductModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
|
||||
@@ -106,18 +106,6 @@ func (m *defaultFsProductPriceModel) Update(ctx context.Context, newData *FsProd
|
||||
return err
|
||||
}
|
||||
|
||||
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) {
|
||||
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
|
||||
}
|
||||
func (m *defaultFsProductPriceModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
|
||||
@@ -88,28 +88,7 @@ func (m *defaultFsProductSizeModel) Update(ctx context.Context, data *FsProductS
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.Title, data.Cover, data.CoverImg, data.Capacity, data.Status, data.Sort, data.Remark, data.PartsCanDeleted, data.Id)
|
||||
return err
|
||||
}
|
||||
func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table)
|
||||
err = m.conn.QueryRowCtx(ctx, &total, query, status)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (m *defaultFsProductSizeModel) FindAllByStatus(ctx context.Context, status int, sort int) (resp []FsProductSize, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ? ", fsProductSizeRows, 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)
|
||||
}
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, status)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *defaultFsProductSizeModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
|
||||
24
model/fsproducttemplatetagsmodel.go
Executable file
24
model/fsproducttemplatetagsmodel.go
Executable file
@@ -0,0 +1,24 @@
|
||||
package model
|
||||
|
||||
import "github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
|
||||
var _ FsProductTemplateTagsModel = (*customFsProductTemplateTagsModel)(nil)
|
||||
|
||||
type (
|
||||
// FsProductTemplateTagsModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsProductTemplateTagsModel.
|
||||
FsProductTemplateTagsModel interface {
|
||||
fsProductTemplateTagsModel
|
||||
}
|
||||
|
||||
customFsProductTemplateTagsModel struct {
|
||||
*defaultFsProductTemplateTagsModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsProductTemplateTagsModel returns a model for the database table.
|
||||
func NewFsProductTemplateTagsModel(conn sqlx.SqlConn) FsProductTemplateTagsModel {
|
||||
return &customFsProductTemplateTagsModel{
|
||||
defaultFsProductTemplateTagsModel: newFsProductTemplateTagsModel(conn),
|
||||
}
|
||||
}
|
||||
87
model/fsproducttemplatetagsmodel_gen.go
Executable file
87
model/fsproducttemplatetagsmodel_gen.go
Executable file
@@ -0,0 +1,87 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/builder"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlc"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"github.com/zeromicro/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
var (
|
||||
fsProductTemplateTagsFieldNames = builder.RawFieldNames(&FsProductTemplateTags{})
|
||||
fsProductTemplateTagsRows = strings.Join(fsProductTemplateTagsFieldNames, ",")
|
||||
fsProductTemplateTagsRowsExpectAutoSet = strings.Join(stringx.Remove(fsProductTemplateTagsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
|
||||
fsProductTemplateTagsRowsWithPlaceHolder = strings.Join(stringx.Remove(fsProductTemplateTagsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
|
||||
)
|
||||
|
||||
type (
|
||||
fsProductTemplateTagsModel interface {
|
||||
Insert(ctx context.Context, data *FsProductTemplateTags) (sql.Result, error)
|
||||
FindOne(ctx context.Context, id int64) (*FsProductTemplateTags, error)
|
||||
Update(ctx context.Context, data *FsProductTemplateTags) error
|
||||
Delete(ctx context.Context, id int64) error
|
||||
ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error)
|
||||
}
|
||||
|
||||
defaultFsProductTemplateTagsModel struct {
|
||||
conn sqlx.SqlConn
|
||||
table string
|
||||
}
|
||||
|
||||
FsProductTemplateTags struct {
|
||||
Id int64 `db:"id"` // ID
|
||||
Title string `db:"title"` // 标题
|
||||
Status int64 `db:"status"` // 状态 1:可用
|
||||
CreateAt int64 `db:"create_at"` // 创建时间
|
||||
}
|
||||
)
|
||||
|
||||
func newFsProductTemplateTagsModel(conn sqlx.SqlConn) *defaultFsProductTemplateTagsModel {
|
||||
return &defaultFsProductTemplateTagsModel{
|
||||
conn: conn,
|
||||
table: "`fs_product_template_tags`",
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) Delete(ctx context.Context, id int64) error {
|
||||
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) FindOne(ctx context.Context, id int64) (*FsProductTemplateTags, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", fsProductTemplateTagsRows, m.table)
|
||||
var resp FsProductTemplateTags
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
|
||||
switch err {
|
||||
case nil:
|
||||
return &resp, nil
|
||||
case sqlc.ErrNotFound:
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) Insert(ctx context.Context, data *FsProductTemplateTags) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, fsProductTemplateTagsRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.Title, data.Status)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) Update(ctx context.Context, data *FsProductTemplateTags) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, fsProductTemplateTagsRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.Title, data.Status, data.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
@@ -29,6 +29,7 @@ type (
|
||||
Delete(ctx context.Context, id int64) error
|
||||
FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error)
|
||||
FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error)
|
||||
FindAllByModelIds(ctx context.Context, modelIds []string, sort int) (resp []FsProductTemplateV2, err error)
|
||||
}
|
||||
|
||||
defaultFsProductTemplateV2Model struct {
|
||||
@@ -94,26 +95,6 @@ func (m *defaultFsProductTemplateV2Model) Update(ctx context.Context, data *FsPr
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.ModelId, data.Title, data.Name, data.CoverImg, data.TemplateInfo, data.MaterialImg, data.Sort, data.LogoWidth, data.LogoHeight, data.IsPublic, data.Status, data.Ctime, data.Tag, data.IsDel, data.Id)
|
||||
return err
|
||||
}
|
||||
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) {
|
||||
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")
|
||||
case 2:
|
||||
query = fmt.Sprintf("%s order by `sort` DESC")
|
||||
}
|
||||
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), productId, 0, 1); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (m *defaultFsProductTemplateV2Model) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
|
||||
43
model/self_fsproductmodel.go
Executable file
43
model/self_fsproductmodel.go
Executable file
@@ -0,0 +1,43 @@
|
||||
// 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
|
||||
}
|
||||
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
|
||||
}
|
||||
18
model/self_fsproductmodel3dlightmodel.go
Executable file
18
model/self_fsproductmodel3dlightmodel.go
Executable file
@@ -0,0 +1,18 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (m *defaultFsProductModel3dLightModel) ListByIds(ctx context.Context, ids []string) (resp []FsProductModel3dLight, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` in (?)", fsProductModel3dLightRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(ids, ","))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
21
model/self_fsproductmodel3dmodel.go
Executable file
21
model/self_fsproductmodel3dmodel.go
Executable file
@@ -0,0 +1,21 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (m *defaultFsProductModel3dModel) ListBySizeIdsTag(ctx context.Context, sizeIds []string, tag int) (resp []FsProductModel3d, err error) {
|
||||
if len(sizeIds) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
query := fmt.Sprintf("select %s from %s where `size_id` in (?) and `tag` = ?", fsProductModel3dRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(sizeIds, ","), tag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
26
model/self_fsproductpricemodel.go
Executable file
26
model/self_fsproductpricemodel.go
Executable file
@@ -0,0 +1,26 @@
|
||||
// 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
|
||||
}
|
||||
31
model/self_fsproductsizemodel.go
Executable file
31
model/self_fsproductsizemodel.go
Executable file
@@ -0,0 +1,31 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table)
|
||||
err = m.conn.QueryRowCtx(ctx, &total, query, status)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (m *defaultFsProductSizeModel) FindAllByStatus(ctx context.Context, status int, sort int) (resp []FsProductSize, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ? ", fsProductSizeRows, 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)
|
||||
}
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, status)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
20
model/self_fsproducttemplatetagsmodel.go
Executable file
20
model/self_fsproducttemplatetagsmodel.go
Executable file
@@ -0,0 +1,20 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (m *defaultFsProductTemplateTagsModel) ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error) {
|
||||
if len(ids) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
query := fmt.Sprintf("select %s from %s where `id` in (?) ", fsProductTemplateTagsRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, ids)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
50
model/self_fsproducttemplatev2model.go
Executable file
50
model/self_fsproducttemplatev2model.go
Executable file
@@ -0,0 +1,50 @@
|
||||
// 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
|
||||
}
|
||||
|
||||
func (m *defaultFsProductTemplateV2Model) FindAllByModelIds(ctx context.Context, modelIds []string, sort int) (resp []FsProductTemplateV2, err error) {
|
||||
if len(modelIds) == 0 {
|
||||
return
|
||||
}
|
||||
query := fmt.Sprintf("select %s from %s where `model_id` in (?) 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, ","), 0, 1); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
3
model/self_fstagsmodel.go
Executable file
3
model/self_fstagsmodel.go
Executable file
@@ -0,0 +1,3 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
Reference in New Issue
Block a user