【增加发布地图类型】
This commit is contained in:
parent
03fa2fee4b
commit
19329dc823
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user