fix
This commit is contained in:
18
model/gorm/fsaddressmodel.go
Executable file
18
model/gorm/fsaddressmodel.go
Executable file
@@ -0,0 +1,18 @@
|
||||
package gorm
|
||||
|
||||
type FsAddress struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
UserId *int64 `gorm:"default:0" json:"user_id"` // 用户ID
|
||||
Name *string `gorm:"default:''" json:"name"` // 地址名称
|
||||
FirstName *string `gorm:"default:''" json:"first_name"` // FirstName
|
||||
LastName *string `gorm:"default:''" json:"last_name"` // LastName
|
||||
Mobile *string `gorm:"default:''" json:"mobile"` // 手机号码
|
||||
Street *string `gorm:"default:''" json:"street"` // 街道
|
||||
Suite *string `gorm:"default:''" json:"suite"` // 房号
|
||||
City *string `gorm:"default:''" json:"city"` // 城市
|
||||
State *string `gorm:"default:''" json:"state"` // 州名
|
||||
Country *string `gorm:"default:''" json:"country"` // 国家
|
||||
ZipCode *string `gorm:"default:''" json:"zip_code"` // 邮编
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 1正常 0异常
|
||||
IsDefault *int64 `gorm:"default:0" json:"is_default"` // 1默认地址,0非默认地址
|
||||
}
|
||||
12
model/gorm/fscanteenproductmodel.go
Executable file
12
model/gorm/fscanteenproductmodel.go
Executable file
@@ -0,0 +1,12 @@
|
||||
package gorm
|
||||
|
||||
type FsCanteenProduct struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||
CanteenType *int64 `gorm:"default:0" json:"canteen_type"` // 餐厅类别id
|
||||
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品id
|
||||
SizeId *int64 `gorm:"default:0" json:"size_id"` // 尺寸id
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态位 1启用0停用
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||
Sid *string `gorm:"default:''" json:"sid"` // 前端带入的id
|
||||
}
|
||||
9
model/gorm/fscanteentypemodel.go
Executable file
9
model/gorm/fscanteentypemodel.go
Executable file
@@ -0,0 +1,9 @@
|
||||
package gorm
|
||||
|
||||
type FsCanteenType struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||
Name *string `gorm:"default:''" json:"name"` // 餐厅名字
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态位 1启用0停用
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||
}
|
||||
14
model/gorm/fsfaqmodel.go
Executable file
14
model/gorm/fsfaqmodel.go
Executable file
@@ -0,0 +1,14 @@
|
||||
package gorm
|
||||
|
||||
import "database/sql"
|
||||
|
||||
type FsFaq struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
TagId *int64 `gorm:"default:0" json:"tag_id"` // 分类ID
|
||||
TagName *string `gorm:"default:''" json:"tag_name"` // 分类名称
|
||||
Title *string `gorm:"default:''" json:"title"` // 标题
|
||||
Content *string `gorm:"default:''" json:"content"` // 内容
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态(0:禁用,1:启用)
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
Ctime *sql.NullInt64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||
}
|
||||
9
model/gorm/fsfontmodel.go
Executable file
9
model/gorm/fsfontmodel.go
Executable file
@@ -0,0 +1,9 @@
|
||||
package gorm
|
||||
|
||||
type FsFont struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"` // id
|
||||
Title *string `gorm:"default:''" json:"title"` // 字体名字
|
||||
LinuxFontname *string `gorm:"default:''" json:"linux_fontname"` // linux对应字体名
|
||||
FilePath *string `gorm:"default:''" json:"file_path"` // 字体文件路径
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
}
|
||||
33
model/gorm/fsproductmodel.go
Executable file
33
model/gorm/fsproductmodel.go
Executable file
@@ -0,0 +1,33 @@
|
||||
package gorm
|
||||
|
||||
type FsProduct struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
Sn *string `gorm:"default:''" json:"sn"` // 商品编号 P98f087j
|
||||
Type *int64 `gorm:"default:0" json:"type"` // 分类ID
|
||||
Title *string `gorm:"default:''" json:"title"` // 名称
|
||||
TitleCn *string `gorm:"default:''" json:"title_cn"` // 中文名称
|
||||
Cover *string `gorm:"default:''" json:"cover"` // 封面图
|
||||
Imgs *string `gorm:"default:''" json:"imgs"` // 一个或多个介绍图或视频
|
||||
Keywords *string `gorm:"default:''" json:"keywords"` // 关键字
|
||||
Intro *string `gorm:"default:''" json:"intro"` // 简要描述
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
SelledNum *int64 `gorm:"default:0" json:"selled_num"` // 已卖数量
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||
View *int64 `gorm:"default:0" json:"view"` // 浏览量
|
||||
SizeIds *string `gorm:"default:''" json:"size_ids"` // 尺寸 1,2,3,4
|
||||
MaterialIds *string `gorm:"default:''" json:"material_ids"` // 材质 1,2,3
|
||||
TagIds *string `gorm:"default:''" json:"tag_ids"` // 标签 逗号间隔
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态位 弃用
|
||||
ProduceDays *int64 `gorm:"default:0" json:"produce_days"` // 生产天数
|
||||
DeliveryDays *int64 `gorm:"default:0" json:"delivery_days"` // 运送天数
|
||||
CoverImg *string `gorm:"default:''" json:"cover_img"` // 背景图
|
||||
IsShelf *int64 `gorm:"default:1" json:"is_shelf"` // 是否上架
|
||||
IsRecommend *int64 `gorm:"default:1" json:"is_recommend"` // 是否推荐
|
||||
IsHot *int64 `gorm:"default:1" json:"is_hot"` // 是否热销
|
||||
IsProtection *int64 `gorm:"default:1" json:"is_protection"` // 是否环保
|
||||
IsMicrowave *int64 `gorm:"default:1" json:"is_microwave"` // 是否可微波炉
|
||||
IsDel *int64 `gorm:"default:0" json:"is_del"` // 是否删除
|
||||
RecommendProduct *string `gorm:"default:''" json:"recommend_product"` // 推荐产品id例如: 1,3,4,5
|
||||
RecommendProductSort *string `gorm:"default:''" json:"recommend_product_sort"` // 推荐排序例如:1324
|
||||
SceneIds *string `gorm:"default:''" json:"scene_ids"` // 关联的场景id
|
||||
}
|
||||
9
model/gorm/fsproductmodel3dlightmodel.go
Executable file
9
model/gorm/fsproductmodel3dlightmodel.go
Executable file
@@ -0,0 +1,9 @@
|
||||
package gorm
|
||||
|
||||
type FsProductModel3dLight struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
Name *string `gorm:"default:''" json:"name"` // 灯光名称
|
||||
Info *string `gorm:"default:''" json:"info"` // 灯光数据(json格式)
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态值(1:显示,0:删除)
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 创建时间
|
||||
}
|
||||
22
model/gorm/fsproductmodel3dmodel.go
Executable file
22
model/gorm/fsproductmodel3dmodel.go
Executable file
@@ -0,0 +1,22 @@
|
||||
package gorm
|
||||
|
||||
type FsProductModel3d struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||||
Tag *int64 `gorm:"default:1" json:"tag"` // 类别(1:模型,2:配件,3:场景)
|
||||
Title *string `gorm:"default:''" json:"title"` // 标题
|
||||
Name *string `gorm:"default:''" json:"name"` // 详情页展示名称
|
||||
ModelInfo *string `gorm:"default:''" json:"model_info"` // 模型详情
|
||||
MaterialId *int64 `gorm:"default:0" json:"material_id"` // 材质ID
|
||||
SizeId *int64 `gorm:"default:0" json:"size_id"` // 尺寸ID
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
Light *int64 `gorm:"default:0" json:"light"` // 灯光组
|
||||
LightList *string `gorm:"default:''" json:"light_list"` // 灯光备选项
|
||||
PartId *int64 `gorm:"default:0" json:"part_id"` // 配件选项id(配件就是模型的id)
|
||||
PartList *string `gorm:"default:''" json:"part_list"` // 配件备选项
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态位 1显示 0删除
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||
OptionTemplate *int64 `gorm:"default:0" json:"option_template"` // 配件绑定的公共模板
|
||||
Price *int64 `gorm:"default:0" json:"price"` // 仅配件用,配件的价格, 单位:美分
|
||||
Sku *string `gorm:"default:''" json:"sku"` // sku
|
||||
}
|
||||
17
model/gorm/fsproductpricemodel.go
Executable file
17
model/gorm/fsproductpricemodel.go
Executable file
@@ -0,0 +1,17 @@
|
||||
package gorm
|
||||
|
||||
type FsProductPrice struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"`
|
||||
Sn string `gorm:"default:''" json:"sn"` // 唯一编码
|
||||
Title string `gorm:"default:''" json:"title"` // 标题描述
|
||||
ProductId int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||||
MaterialId int64 `gorm:"default:0" json:"material_id"` // 材质ID
|
||||
SizeId int64 `gorm:"default:0" json:"size_id"` // 尺寸ID
|
||||
EachBoxNum int64 `gorm:"default:0" json:"each_box_num"` // 每一箱的个数
|
||||
EachBoxWeight float64 `gorm:"default:0" json:"each_box_weight"` // 每一箱的重量 单位KG
|
||||
MinBuyNum int64 `gorm:"default:0" json:"min_buy_num"` // 最少购买量
|
||||
StepNum string `gorm:"default:''" json:"step_num"` // 数量阶梯 eg:10,20,30
|
||||
StepPrice string `gorm:"default:''" json:"step_price"` // 价格阶梯 eg:100,50,25
|
||||
Status int64 `gorm:"default:1" json:"status"` // 是否可用
|
||||
IsDefault int64 `gorm:"default:0" json:"is_default"` // 是否默认
|
||||
}
|
||||
69
model/gorm/fsproductsizemodel.go
Executable file
69
model/gorm/fsproductsizemodel.go
Executable file
@@ -0,0 +1,69 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var _ FsProductSizeModel = (*customFsProductSizeModel)(nil)
|
||||
|
||||
type (
|
||||
// FsProductSizeModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsProductSizeModel.
|
||||
FsProductSizeModel interface {
|
||||
fsProductSizeModel
|
||||
CountByStatus(ctx context.Context, status int) (total int, err error)
|
||||
GetAllByProductIds(ctx context.Context, productIds []string, sort string) (resp []FsProductSize, err error)
|
||||
GetAllByIds(ctx context.Context, ids []string, sort string) (resp []FsProductSize, err error)
|
||||
}
|
||||
|
||||
customFsProductSizeModel struct {
|
||||
*defaultFsProductSizeModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsProductSizeModel returns a model for the database table.
|
||||
func NewFsProductSizeModel(conn sqlx.SqlConn) FsProductSizeModel {
|
||||
return &customFsProductSizeModel{
|
||||
defaultFsProductSizeModel: newFsProductSizeModel(conn),
|
||||
}
|
||||
}
|
||||
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) GetAllByProductIds(ctx context.Context, productIds []string, sort string) (resp []FsProductSize, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `product_id` in(?) and `status` = ? ", fsProductSizeRows, 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)
|
||||
}
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *defaultFsProductSizeModel) GetAllByIds(ctx context.Context, ids []string, sort string) (resp []FsProductSize, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` in (?) and `status` = ? ", fsProductSizeRows, 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)
|
||||
}
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(ids, ","), 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
40
model/gorm/fsproducttemplatetagsmodel.go
Executable file
40
model/gorm/fsproducttemplatetagsmodel.go
Executable file
@@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"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
|
||||
ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error)
|
||||
}
|
||||
|
||||
customFsProductTemplateTagsModel struct {
|
||||
*defaultFsProductTemplateTagsModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsProductTemplateTagsModel returns a model for the database table.
|
||||
func NewFsProductTemplateTagsModel(conn sqlx.SqlConn) FsProductTemplateTagsModel {
|
||||
return &customFsProductTemplateTagsModel{
|
||||
defaultFsProductTemplateTagsModel: newFsProductTemplateTagsModel(conn),
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
72
model/gorm/fsproducttemplatev2model.go
Executable file
72
model/gorm/fsproducttemplatev2model.go
Executable file
@@ -0,0 +1,72 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var _ FsProductTemplateV2Model = (*customFsProductTemplateV2Model)(nil)
|
||||
|
||||
type (
|
||||
// FsProductTemplateV2Model is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsProductTemplateV2Model.
|
||||
FsProductTemplateV2Model interface {
|
||||
fsProductTemplateV2Model
|
||||
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)
|
||||
}
|
||||
|
||||
customFsProductTemplateV2Model struct {
|
||||
*defaultFsProductTemplateV2Model
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsProductTemplateV2Model returns a model for the database table.
|
||||
func NewFsProductTemplateV2Model(conn sqlx.SqlConn) FsProductTemplateV2Model {
|
||||
return &customFsProductTemplateV2Model{
|
||||
defaultFsProductTemplateV2Model: newFsProductTemplateV2Model(conn),
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
38
model/gorm/fsqrcodesetmodel.go
Executable file
38
model/gorm/fsqrcodesetmodel.go
Executable file
@@ -0,0 +1,38 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var _ FsQrcodeSetModel = (*customFsQrcodeSetModel)(nil)
|
||||
|
||||
type (
|
||||
// FsQrcodeSetModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsQrcodeSetModel.
|
||||
FsQrcodeSetModel interface {
|
||||
fsQrcodeSetModel
|
||||
GetAll(ctx context.Context) (resp []FsQrcodeSet, err error)
|
||||
}
|
||||
|
||||
customFsQrcodeSetModel struct {
|
||||
*defaultFsQrcodeSetModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsQrcodeSetModel returns a model for the database table.
|
||||
func NewFsQrcodeSetModel(conn sqlx.SqlConn) FsQrcodeSetModel {
|
||||
return &customFsQrcodeSetModel{
|
||||
defaultFsQrcodeSetModel: newFsQrcodeSetModel(conn),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsQrcodeSetModel) GetAll(ctx context.Context) (resp []FsQrcodeSet, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ?", fsQrcodeSetRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
38
model/gorm/fsstandardlogomodel.go
Executable file
38
model/gorm/fsstandardlogomodel.go
Executable file
@@ -0,0 +1,38 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var _ FsStandardLogoModel = (*customFsStandardLogoModel)(nil)
|
||||
|
||||
type (
|
||||
// FsStandardLogoModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsStandardLogoModel.
|
||||
FsStandardLogoModel interface {
|
||||
fsStandardLogoModel
|
||||
GetAll(ctx context.Context) (resp []FsStandardLogo, err error)
|
||||
}
|
||||
|
||||
customFsStandardLogoModel struct {
|
||||
*defaultFsStandardLogoModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsStandardLogoModel returns a model for the database table.
|
||||
func NewFsStandardLogoModel(conn sqlx.SqlConn) FsStandardLogoModel {
|
||||
return &customFsStandardLogoModel{
|
||||
defaultFsStandardLogoModel: newFsStandardLogoModel(conn),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsStandardLogoModel) GetAll(ctx context.Context) (resp []FsStandardLogo, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = ? ", fsStandardLogoRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
48
model/gorm/fstagsmodel.go
Executable file
48
model/gorm/fstagsmodel.go
Executable file
@@ -0,0 +1,48 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var _ FsTagsModel = (*customFsTagsModel)(nil)
|
||||
|
||||
type (
|
||||
// FsTagsModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsTagsModel.
|
||||
FsTagsModel interface {
|
||||
fsTagsModel
|
||||
GetAllByLevel(ctx context.Context, level int) (resp []FsTags, err error)
|
||||
GetAllByIds(ctx context.Context, ids []string) (resp []FsTags, err error)
|
||||
}
|
||||
|
||||
customFsTagsModel struct {
|
||||
*defaultFsTagsModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsTagsModel returns a model for the database table.
|
||||
func NewFsTagsModel(conn sqlx.SqlConn) FsTagsModel {
|
||||
return &customFsTagsModel{
|
||||
defaultFsTagsModel: newFsTagsModel(conn),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsTagsModel) GetAllByLevel(ctx context.Context, level int) (resp []FsTags, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `level` = ? and `status` = ?", fsTagsRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, level, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
func (m *defaultFsTagsModel) GetAllByIds(ctx context.Context, ids []string) (resp []FsTags, err error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` in (?) and `status` = ?", fsTagsRows, m.table)
|
||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(ids, ","), 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
36
model/gorm/fsusermodel.go
Executable file
36
model/gorm/fsusermodel.go
Executable file
@@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var _ FsUserModel = (*customFsUserModel)(nil)
|
||||
|
||||
type (
|
||||
// FsUserModel is an interface to be customized, add more methods here,
|
||||
// and implement the added methods in customFsUserModel.
|
||||
FsUserModel interface {
|
||||
fsUserModel
|
||||
UpdateVerificationToken(ctx context.Context, userid int64, token string) error
|
||||
}
|
||||
|
||||
customFsUserModel struct {
|
||||
*defaultFsUserModel
|
||||
}
|
||||
)
|
||||
|
||||
// NewFsUserModel returns a model for the database table.
|
||||
func NewFsUserModel(conn sqlx.SqlConn) FsUserModel {
|
||||
return &customFsUserModel{
|
||||
defaultFsUserModel: newFsUserModel(conn),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultFsUserModel) UpdateVerificationToken(ctx context.Context, userid int64, verificationToken string) error {
|
||||
query := fmt.Sprintf("update %s set `verification_token` = ? where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, verificationToken, userid)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user