feat:完善项目管理,增加技术成果数据

This commit is contained in:
henry
2021-12-14 13:34:42 +08:00
parent 3bb8f96d84
commit 3c55143278
11 changed files with 542 additions and 2 deletions

View File

@ -0,0 +1,94 @@
package model
import (
"SciencesServer/app/basic/config"
"encoding/json"
)
// TechnologyAchievement 技术成果数据模型
type TechnologyAchievement struct {
Model
Local
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"`
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"`
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
}
// 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) 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{}
}

View File

@ -0,0 +1,22 @@
package model
import "time"
// TechnologyAchievementVisit 科技成果访问数据模型
type TechnologyAchievementVisit struct {
Model
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
AchievementID uint64 `gorm:"column:achievement_id;index:idx_achievement_visit_achievement;type:int(11);default:0;comment:科技成果ID" json:"-"`
Count int `gorm:"column:count;type:int(8);default:0;comment:浏览次数" json:"count"`
Date time.Time `gorm:"column:date;type:datetime;not null;comment:浏览时间" json:"date"`
ModelDeleted
ModelAt
}
func (m *TechnologyAchievementVisit) TableName() string {
return "technology_achievement_visit"
}
func NewTechnologyAchievementVisit() *TechnologyAchievementVisit {
return &TechnologyAchievementVisit{}
}