From 19329dc8237126ad6943292ededbbef33a3f2b75 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 18 Sep 2023 15:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=B1=BB=E5=9E=8B=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/dbquery/published_gi.gen.go | 6 +++++- db/model/published_gi.gen.go | 1 + dto/projectLink.go | 3 ++- service/publishedGi.go | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/db/dbquery/published_gi.gen.go b/db/dbquery/published_gi.gen.go index 309ddab..499a470 100644 --- a/db/dbquery/published_gi.gen.go +++ b/db/dbquery/published_gi.gen.go @@ -35,6 +35,7 @@ func newPublishedGi(db *gorm.DB, opts ...gen.DOOption) publishedGi { _publishedGi.Category = field.NewString(tableName, "category") _publishedGi.Note = field.NewString(tableName, "note") _publishedGi.Status = field.NewInt32(tableName, "status") + _publishedGi.Type = field.NewInt32(tableName, "type") _publishedGi.fillFieldMap() @@ -53,6 +54,7 @@ type publishedGi struct { Category field.String // 厂家信息 Note field.String // 发布描述 Status field.Int32 // 显示状态 + Type field.Int32 // 数据类型 fieldMap map[string]field.Expr } @@ -77,6 +79,7 @@ func (p *publishedGi) updateTableName(table string) *publishedGi { p.Category = field.NewString(table, "category") p.Note = field.NewString(table, "note") p.Status = field.NewInt32(table, "status") + p.Type = field.NewInt32(table, "type") p.fillFieldMap() @@ -93,7 +96,7 @@ func (p *publishedGi) GetFieldByName(fieldName string) (field.OrderExpr, bool) { } func (p *publishedGi) fillFieldMap() { - p.fieldMap = make(map[string]field.Expr, 8) + p.fieldMap = make(map[string]field.Expr, 9) p.fieldMap["id"] = p.ID p.fieldMap["name"] = p.Name p.fieldMap["proto"] = p.Proto @@ -102,6 +105,7 @@ func (p *publishedGi) fillFieldMap() { p.fieldMap["category"] = p.Category p.fieldMap["note"] = p.Note p.fieldMap["status"] = p.Status + p.fieldMap["type"] = p.Type } func (p publishedGi) clone(db *gorm.DB) publishedGi { diff --git a/db/model/published_gi.gen.go b/db/model/published_gi.gen.go index 78ba129..707ddcb 100644 --- a/db/model/published_gi.gen.go +++ b/db/model/published_gi.gen.go @@ -20,6 +20,7 @@ type PublishedGi struct { Category string `gorm:"column:category;comment:厂家信息" json:"category"` // 厂家信息 Note string `gorm:"column:note;comment:发布描述" json:"note"` // 发布描述 Status int32 `gorm:"column:status;default:1;comment:显示状态" json:"status"` // 显示状态 + Type int32 `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型 } // TableName PublishedGi's table name diff --git a/dto/projectLink.go b/dto/projectLink.go index 362fc80..6b50a87 100644 --- a/dto/projectLink.go +++ b/dto/projectLink.go @@ -20,6 +20,7 @@ type PublishedGiLinkDto struct { Id int32 `json:"id" form:"id"` Name string `json:"name" form:"name"` Category string `json:"category" form:"category"` + Type int32 `json:"type" form:"type"` } func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto { @@ -35,7 +36,7 @@ func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto { func ConvertFromPublishedGiLink(giSlice []*model.PublishedGi) []*PublishedGiLinkDto { var result []*PublishedGiLinkDto for _, gi := range giSlice { - result = append(result, &PublishedGiLinkDto{Id: gi.ID, Name: gi.Name, Category: gi.Category}) + result = append(result, &PublishedGiLinkDto{Id: gi.ID, Name: gi.Name, Category: gi.Category, Type: gi.Type}) } return result } diff --git a/service/publishedGi.go b/service/publishedGi.go index 81e579c..0f1db2b 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -74,6 +74,7 @@ func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) { PublishAt: time.Now(), Category: draft.Category, Note: req.Note, + Type: draft.Type, Status: 1, } //插入新数据 @@ -117,6 +118,7 @@ func SaveAsDraftingFromPublish(id int32, user *model.User, name string) { CreatorID: user.ID, CreatedAt: time.Now(), UpdateAt: time.Now(), + Type: publishedGi.Type, } err1 := dbquery.Drafting.Save(drafting) if err1 != nil { @@ -136,7 +138,7 @@ func QueryProjectPublishedGi(id int32) []*model.PublishedGi { mids[i] = m.Mid } dp := dbquery.PublishedGi - publishedGis, _ := dp.Select(dp.ID, dp.Name, dp.Category).Where(dp.ID.In(mids...), dp.Status.Eq(1)).Find() + publishedGis, _ := dp.Select(dp.ID, dp.Name, dp.Category, dp.Type).Where(dp.ID.In(mids...), dp.Status.Eq(1)).Find() return publishedGis }