【增加发布地图类型】
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.Category = field.NewString(tableName, "category")
|
||||||
_publishedGi.Note = field.NewString(tableName, "note")
|
_publishedGi.Note = field.NewString(tableName, "note")
|
||||||
_publishedGi.Status = field.NewInt32(tableName, "status")
|
_publishedGi.Status = field.NewInt32(tableName, "status")
|
||||||
|
_publishedGi.Type = field.NewInt32(tableName, "type")
|
||||||
|
|
||||||
_publishedGi.fillFieldMap()
|
_publishedGi.fillFieldMap()
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ type publishedGi struct {
|
|||||||
Category field.String // 厂家信息
|
Category field.String // 厂家信息
|
||||||
Note field.String // 发布描述
|
Note field.String // 发布描述
|
||||||
Status field.Int32 // 显示状态
|
Status field.Int32 // 显示状态
|
||||||
|
Type field.Int32 // 数据类型
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@ -77,6 +79,7 @@ func (p *publishedGi) updateTableName(table string) *publishedGi {
|
|||||||
p.Category = field.NewString(table, "category")
|
p.Category = field.NewString(table, "category")
|
||||||
p.Note = field.NewString(table, "note")
|
p.Note = field.NewString(table, "note")
|
||||||
p.Status = field.NewInt32(table, "status")
|
p.Status = field.NewInt32(table, "status")
|
||||||
|
p.Type = field.NewInt32(table, "type")
|
||||||
|
|
||||||
p.fillFieldMap()
|
p.fillFieldMap()
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ func (p *publishedGi) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *publishedGi) fillFieldMap() {
|
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["id"] = p.ID
|
||||||
p.fieldMap["name"] = p.Name
|
p.fieldMap["name"] = p.Name
|
||||||
p.fieldMap["proto"] = p.Proto
|
p.fieldMap["proto"] = p.Proto
|
||||||
@ -102,6 +105,7 @@ func (p *publishedGi) fillFieldMap() {
|
|||||||
p.fieldMap["category"] = p.Category
|
p.fieldMap["category"] = p.Category
|
||||||
p.fieldMap["note"] = p.Note
|
p.fieldMap["note"] = p.Note
|
||||||
p.fieldMap["status"] = p.Status
|
p.fieldMap["status"] = p.Status
|
||||||
|
p.fieldMap["type"] = p.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p publishedGi) clone(db *gorm.DB) publishedGi {
|
func (p publishedGi) clone(db *gorm.DB) publishedGi {
|
||||||
|
@ -20,6 +20,7 @@ type PublishedGi struct {
|
|||||||
Category string `gorm:"column:category;comment:厂家信息" json:"category"` // 厂家信息
|
Category string `gorm:"column:category;comment:厂家信息" json:"category"` // 厂家信息
|
||||||
Note string `gorm:"column:note;comment:发布描述" json:"note"` // 发布描述
|
Note string `gorm:"column:note;comment:发布描述" json:"note"` // 发布描述
|
||||||
Status int32 `gorm:"column:status;default:1;comment:显示状态" json:"status"` // 显示状态
|
Status int32 `gorm:"column:status;default:1;comment:显示状态" json:"status"` // 显示状态
|
||||||
|
Type int32 `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName PublishedGi's table name
|
// TableName PublishedGi's table name
|
||||||
|
@ -20,6 +20,7 @@ type PublishedGiLinkDto struct {
|
|||||||
Id int32 `json:"id" form:"id"`
|
Id int32 `json:"id" form:"id"`
|
||||||
Name string `json:"name" form:"name"`
|
Name string `json:"name" form:"name"`
|
||||||
Category string `json:"category" form:"category"`
|
Category string `json:"category" form:"category"`
|
||||||
|
Type int32 `json:"type" form:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto {
|
func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto {
|
||||||
@ -35,7 +36,7 @@ func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto {
|
|||||||
func ConvertFromPublishedGiLink(giSlice []*model.PublishedGi) []*PublishedGiLinkDto {
|
func ConvertFromPublishedGiLink(giSlice []*model.PublishedGi) []*PublishedGiLinkDto {
|
||||||
var result []*PublishedGiLinkDto
|
var result []*PublishedGiLinkDto
|
||||||
for _, gi := range giSlice {
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) {
|
|||||||
PublishAt: time.Now(),
|
PublishAt: time.Now(),
|
||||||
Category: draft.Category,
|
Category: draft.Category,
|
||||||
Note: req.Note,
|
Note: req.Note,
|
||||||
|
Type: draft.Type,
|
||||||
Status: 1,
|
Status: 1,
|
||||||
}
|
}
|
||||||
//插入新数据
|
//插入新数据
|
||||||
@ -117,6 +118,7 @@ func SaveAsDraftingFromPublish(id int32, user *model.User, name string) {
|
|||||||
CreatorID: user.ID,
|
CreatorID: user.ID,
|
||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
UpdateAt: time.Now(),
|
UpdateAt: time.Now(),
|
||||||
|
Type: publishedGi.Type,
|
||||||
}
|
}
|
||||||
err1 := dbquery.Drafting.Save(drafting)
|
err1 := dbquery.Drafting.Save(drafting)
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
@ -136,7 +138,7 @@ func QueryProjectPublishedGi(id int32) []*model.PublishedGi {
|
|||||||
mids[i] = m.Mid
|
mids[i] = m.Mid
|
||||||
}
|
}
|
||||||
dp := dbquery.PublishedGi
|
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
|
return publishedGis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user