fix
This commit is contained in:
@@ -6,12 +6,12 @@ import (
|
||||
|
||||
// fs_product_tag_prop 产品标签相关属性表
|
||||
type FsProductTagProp struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
|
||||
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品id
|
||||
TagId *int64 `gorm:"default:0;" json:"tag_id"` // 模板标签id
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 创建时间
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
|
||||
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品id
|
||||
TemplateTagId *int64 `gorm:"default:0;" json:"template_tag_id"` // 模板标签id
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 创建时间
|
||||
}
|
||||
type FsProductTagPropModel struct {
|
||||
db *gorm.DB
|
||||
|
||||
@@ -1,2 +1,21 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
import "context"
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
type GetTagPropByProductIdsWithProductTagRsp struct {
|
||||
FsProductTagProp
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
func (p *FsProductTagPropModel) GetTagPropByProductIdsWithProductTag(ctx context.Context, productIds []int64) (resp []GetTagPropByProductIdsWithProductTagRsp, err error) {
|
||||
if len(productIds) == 0 {
|
||||
return
|
||||
}
|
||||
err = p.db.WithContext(ctx).Table(p.name+" as p ").
|
||||
Joins("left join fs_product_template_tags as t on p.template_tag_id = t.id").
|
||||
Select("p.*,t.title as title").
|
||||
Where("p.product_id in (?) and p.status = ? and t.status = ?", productIds, 1, 1).
|
||||
Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user