feat article添加update
This commit is contained in:
parent
7677cd470a
commit
88976ba8af
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
type ArticleApi interface {
|
type ArticleApi interface {
|
||||||
Upsert(article v2.Article) error
|
Upsert(article v2.Article) error
|
||||||
|
Update(article v2.Article, selects ...string) error
|
||||||
Find(query *FindArticleQuery) (articles []v2.Article, err error)
|
Find(query *FindArticleQuery) (articles []v2.Article, err error)
|
||||||
List(query PageListQuery) (articles []v2.Article, total int64, err error)
|
List(query PageListQuery) (articles []v2.Article, total int64, err error)
|
||||||
Get(query *GetArticleQuery) (article v2.Article, err error)
|
Get(query *GetArticleQuery) (article v2.Article, err error)
|
||||||
@ -48,6 +49,13 @@ func (a *articleApi) Upsert(article v2.Article) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *articleApi) Update(article v2.Article, selects ...string) error {
|
||||||
|
if len(selects) > 0 {
|
||||||
|
selects = []string{"remark", "exclude"}
|
||||||
|
}
|
||||||
|
return a.db.Model(&article).Select(selects).Updates(article).Error
|
||||||
|
}
|
||||||
|
|
||||||
// ******************Find和List
|
// ******************Find和List
|
||||||
|
|
||||||
type FindArticleQuery struct {
|
type FindArticleQuery struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user