fix
This commit is contained in:
@@ -32,3 +32,14 @@ func (pt *FsProductTemplateTagsModel) GetList(ctx context.Context, page, limit i
|
||||
err = db.Offset(offset).Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (pt *FsProductTemplateTagsModel) GetListByTitles(ctx context.Context, titles []string, limit int, orderBy string) (resp []FsProductTemplateTags, err error) {
|
||||
if len(titles) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
db := pt.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Where("`title` in (?) and `status` = ?", titles, 1)
|
||||
if orderBy != "" {
|
||||
db = db.Order(orderBy)
|
||||
}
|
||||
err = db.Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -61,12 +61,9 @@ func (m *FsUserMaterialModel) FindLatestOne(ctx context.Context, userId int64, g
|
||||
if userId == 0 && guestId == 0 {
|
||||
return FsUserMaterial{}, nil
|
||||
}
|
||||
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).Order("id DESC")
|
||||
if userId != 0 {
|
||||
db = db.Where("`user_id` = ?", userId)
|
||||
} else {
|
||||
db = db.Where("`guest_id` = ?", guestId)
|
||||
}
|
||||
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where("`user_id` = ? and `guest_id` = ?", userId, guestId).
|
||||
Order("id DESC")
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
@@ -75,3 +72,8 @@ func (m *FsUserMaterialModel) FindOneById(ctx context.Context, id int64) (resp *
|
||||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).Where("id = ?", id).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (m *FsUserMaterialModel) GetListByUser(ctx context.Context, userId, guestId int64, limit int) (resp *FsUserMaterial, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where("`user_id` = ? and `guest_id` = ?", userId, guestId).Order("id DESC").Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user