feat:完善用户项目模块数据模型
This commit is contained in:
26
app/common/init2.go
Normal file
26
app/common/init2.go
Normal file
@ -0,0 +1,26 @@
|
||||
package common
|
||||
|
||||
type Model struct {
|
||||
TableName string
|
||||
}
|
||||
|
||||
type Option func(model *Model)
|
||||
|
||||
func withModel(tableName string) Option {
|
||||
return func(model *Model) {
|
||||
model.TableName = tableName
|
||||
}
|
||||
}
|
||||
|
||||
func NewModel(option ...Option) *Model {
|
||||
out := new(Model)
|
||||
|
||||
for _, v := range option {
|
||||
v(out)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func Test() {
|
||||
NewModel(withModel(""))
|
||||
}
|
38
app/common/model/technology_project.go
Normal file
38
app/common/model/technology_project.go
Normal file
@ -0,0 +1,38 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// TechnologyProject 技术科研项目数据模型
|
||||
type TechnologyProject struct {
|
||||
Model
|
||||
Local
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Kind string `gorm:"column:kind;type:varchar(100);default:null;comment:类型" json:"kind"`
|
||||
Role TechnologyProjectRole `gorm:"column:role;type:tinyint(1);default:1;comment:课题角色(1:承担单位,2:参与单位)" json:"role"`
|
||||
Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"`
|
||||
Amount float64 `gorm:"column:amount;decimal(10,2);default:0;comment:经费" json:"amount"`
|
||||
Source string `gorm:"column:source;type:varchar(100);default:null;comment:来源" json:"source"`
|
||||
Director string `gorm:"column:director;type:varchar(100);default:null;comment:负责人" json:"director"`
|
||||
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"`
|
||||
ShelfStatus
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type TechnologyProjectRole int
|
||||
|
||||
const (
|
||||
// TechnologyProjectRoleForBear 承担
|
||||
TechnologyProjectRoleForBear TechnologyProjectRole = iota + 1
|
||||
// TechnologyProjectRoleForJoin 参与
|
||||
TechnologyProjectRoleForJoin
|
||||
)
|
||||
|
||||
func (m *TechnologyProject) TableName() string {
|
||||
return "technology_project"
|
||||
}
|
||||
|
||||
func NewTechnologyProject() *TechnologyProject {
|
||||
return &TechnologyProject{}
|
||||
}
|
@ -17,7 +17,7 @@ type TechnologyTopic struct {
|
||||
Mechanism string `gorm:"column:mechanism;type:varchar(30);default:null;comment:机构" json:"mechanism"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"`
|
||||
Amount float64 `gorm:"column:amount;decimal(10,2);default:0;comment:经费" json:"amount"`
|
||||
Source TechnologyTopicSource `gorm:"column:source;type:tinyint(1);default:0comment:来源" json:"source"`
|
||||
Source TechnologyTopicSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"`
|
||||
Kind TechnologyTopicKind `gorm:"column:kind;type:tinyint(1);default:0comment:类型" 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"`
|
||||
|
Reference in New Issue
Block a user