Files
cas_tt_cloud_backend/app/common/model/technology_topic.go
2022-01-21 11:42:58 +08:00

60 lines
2.2 KiB
Go

package model
import (
"SciencesServer/utils"
"time"
)
// TechnologyTopic 技术课题数据模型
type TechnologyTopic struct {
Model
ModelTenant
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称" json:"title"`
Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"`
Emcee string `gorm:"column:emcee;type:varchar(30);default:'';comment:主持人" json:"emcee"`
Mechanism string `gorm:"column:mechanism;type:varchar(30);default:'';comment:机构" json:"mechanism"`
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
Amount float64 `gorm:"column:amount;decimal(10,2);default:0;comment:经费" json:"amount"`
Source TechnologyTopicSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"`
Kind TechnologyTopicKind `gorm:"column:kind;type:tinyint(1);default:0;comment:类型" json:"kind"`
BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:开始时间" json:"begin_at"`
FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"`
TechnologyStatus
ModelDeleted
ModelAt
}
// TechnologyTopicSource 技术课题资助来源
type TechnologyTopicSource int
const (
// TechnologyTopicSourceForCity 市级
TechnologyTopicSourceForCity TechnologyTopicSource = iota + 1
// TechnologyTopicSourceForProvince 省级
TechnologyTopicSourceForProvince
// TechnologyTopicSourceForCountry 国家级
TechnologyTopicSourceForCountry
)
// TechnologyTopicKind 技术课题类型
type TechnologyTopicKind int
func (m *TechnologyTopic) TableName() string {
return m.NewTableName("technology_topic")
}
func (m *TechnologyTopic) GetKeywordAttribute() []string {
keywords := make([]string, 0)
_ = utils.FromJSON(m.Keyword, &keywords)
return keywords
}
func (m *TechnologyTopic) SetKeywordAttribute(keywords []string) {
m.Keyword = utils.AnyToJSON(keywords)
}
func NewTechnologyTopic() *TechnologyTopic {
return &TechnologyTopic{}
}