Files
cas_tt_cloud_backend/app/common/model/technology_achievement.go
2022-01-15 16:48:49 +08:00

114 lines
4.5 KiB
Go

package model
import (
"SciencesServer/app/basic/config"
"encoding/json"
)
// TechnologyAchievement 技术成果数据模型
type TechnologyAchievement struct {
Model
ModelTenant
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
Image
File string `gorm:"column:file;type:varchar(255);default:'';comment:证明材料" json:"file"`
ChargeInfo string `gorm:"column:charge_info;type:varchar(255);default:'';comment:收费信息" json:"charge_info"`
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"-"`
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"`
Source string `gorm:"source:introduce;type:text;comment:成果来源" json:"source"`
Shelf
Status TechnologyAchievementStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
ModelDeleted
ModelAt
}
// TechnologyAchievementChargeInfo 成果收费参数信息
type TechnologyAchievementChargeInfo struct {
VideoFile string `json:"video_file"` // 视频文件
VideoPrice float64 `json:"video_price"` // 视频价格
VideoFreeTime int `json:"video_free_time"` // 视频观看免费时长
}
// TechnologyAchievementMode 技术成本模式
type TechnologyAchievementMode int
const (
// TechnologyAchievementModeForFree 免费模式
TechnologyAchievementModeForFree TechnologyAchievementMode = iota + 1
// TechnologyAchievementModeForCharge 收费模式
TechnologyAchievementModeForCharge
)
// TechnologyAchievementStatus 技术成果状态
type TechnologyAchievementStatus int
const (
// TechnologyAchievementStatusForDraft 草稿箱
TechnologyAchievementStatusForDraft TechnologyAchievementStatus = iota
// TechnologyAchievementStatusForExamining 审核中
TechnologyAchievementStatusForExamining
// TechnologyAchievementStatusForAgree 审核通过
TechnologyAchievementStatusForAgree
// TechnologyAchievementStatusForRefuse 审核拒绝
TechnologyAchievementStatusForRefuse
)
func (m *TechnologyAchievement) TableName() string {
return "technology_achievement"
}
func (m *TechnologyAchievement) GetChargeInfoAttribute() *TechnologyAchievementChargeInfo {
out := new(TechnologyAchievementChargeInfo)
_ = json.Unmarshal([]byte(m.Industry), &out)
return out
}
func (m *TechnologyAchievement) SetChargeInfoAttribute(value *TechnologyAchievementChargeInfo) {
_bytes, _ := json.Marshal(value)
m.ChargeInfo = string(_bytes)
}
func (m *TechnologyAchievement) GetIndustryAttribute() []string {
out := make([]string, 0)
_ = json.Unmarshal([]byte(m.Industry), &out)
return out
}
func (m *TechnologyAchievement) SetIndustryAttribute(value []string) {
_bytes, _ := json.Marshal(value)
m.Industry = string(_bytes)
}
func (m *TechnologyAchievement) GetCustomerAttribute() []string {
out := make([]string, 0)
_ = json.Unmarshal([]byte(m.Customer), &out)
return out
}
func (m *TechnologyAchievement) SetCustomerAttribute(value []string) {
_bytes, _ := json.Marshal(value)
m.Customer = string(_bytes)
}
func (m *TechnologyAchievement) GetKeywordAttribute() []string {
out := make([]string, 0)
_ = json.Unmarshal([]byte(m.Keyword), &out)
return out
}
func (m *TechnologyAchievement) SetKeywordAttribute(value []string) {
_bytes, _ := json.Marshal(value)
m.Keyword = string(_bytes)
}
func NewTechnologyAchievement() *TechnologyAchievement {
return &TechnologyAchievement{}
}