108 lines
4.0 KiB
Go
108 lines
4.0 KiB
Go
package model
|
|
|
|
import (
|
|
"SciencesServer/app/basic/config"
|
|
"encoding/json"
|
|
)
|
|
|
|
// TechnologyProduct 技术产品数据模型
|
|
type TechnologyProduct struct {
|
|
Model
|
|
Local
|
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
|
Title string `gorm:"column:title;type:varchar(100);default:'';comment:产品名称" json:"title"`
|
|
Image
|
|
Video string `gorm:"column:video;type:varchar(255);default:'';comment:视频地址" json:"video"`
|
|
Material string `gorm:"column:material;type:varchar(255);default:'';comment:证明材料" json:"material"`
|
|
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"industry"`
|
|
Customer string `gorm:"column:customer;type:varchar(255);default:'';comment:应用客户" json:"-"`
|
|
Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:技术成熟度" json:"maturity"`
|
|
LeadStandard TechnologyProductLeadStandard `gorm:"column:lead_standard;type:tinyint(1);default:0;comment:领先标准" json:"lead_standard"`
|
|
CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"`
|
|
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
|
|
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
|
Shelf
|
|
Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
|
|
ModelDeleted
|
|
ModelAt
|
|
}
|
|
|
|
// TechnologyProductLeadStandard 领先标准
|
|
type TechnologyProductLeadStandard int
|
|
|
|
const (
|
|
// TechnologyProductLeadStandardForDomesticXJ 国内先进
|
|
TechnologyProductLeadStandardForDomesticXJ TechnologyProductLeadStandard = iota + 1
|
|
// TechnologyProductLeadStandardForDomesticLX 国内领先
|
|
TechnologyProductLeadStandardForDomesticLX
|
|
// TechnologyProductLeadStandardForInternationalXJ 国际先进
|
|
TechnologyProductLeadStandardForInternationalXJ
|
|
// TechnologyProductLeadStandardForInternationalLX 国际领先
|
|
TechnologyProductLeadStandardForInternationalLX
|
|
)
|
|
|
|
// TechnologyProductStatus 状态
|
|
type TechnologyProductStatus int
|
|
|
|
const (
|
|
// TechnologyProductStatusForDraft 草稿箱
|
|
TechnologyProductStatusForDraft TechnologyProductStatus = iota
|
|
// TechnologyProductStatusForExamining 审核中
|
|
TechnologyProductStatusForExamining
|
|
// TechnologyProductStatusForAgree 审核通过
|
|
TechnologyProductStatusForAgree
|
|
// TechnologyProductStatusForRefuse 审核拒绝
|
|
TechnologyProductStatusForRefuse
|
|
)
|
|
|
|
// TechnologyProductShelfStatus 上下架状态
|
|
type TechnologyProductShelfStatus int
|
|
|
|
const (
|
|
// TechnologyProductShelfStatusForUp 上架
|
|
TechnologyProductShelfStatusForUp TechnologyProductShelfStatus = iota + 1
|
|
// TechnologyProductShelfStatusForDown 下架
|
|
TechnologyProductShelfStatusForDown
|
|
)
|
|
|
|
func (m *TechnologyProduct) TableName() string {
|
|
return "technology_product"
|
|
}
|
|
|
|
func (m *TechnologyProduct) GetIndustryAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Industry), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyProduct) SetIndustryAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Industry = string(_bytes)
|
|
}
|
|
|
|
func (m *TechnologyProduct) GetCustomerAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Customer), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyProduct) SetCustomerAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Customer = string(_bytes)
|
|
}
|
|
|
|
func (m *TechnologyProduct) GetKeywordAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Keyword), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyProduct) SetKeywordAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Keyword = string(_bytes)
|
|
}
|
|
|
|
func NewTechnologyProduct() *TechnologyProduct {
|
|
return &TechnologyProduct{}
|
|
}
|