89 lines
3.2 KiB
Go
89 lines
3.2 KiB
Go
package model
|
||
|
||
import (
|
||
"SciencesServer/utils"
|
||
"encoding/json"
|
||
"time"
|
||
)
|
||
|
||
// TechnologyDemand 技术需求数据模型
|
||
type TechnologyDemand struct {
|
||
Model
|
||
ModelTenant
|
||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||
Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"`
|
||
Kind string `gorm:"column:kind;type:varchar(100);default:'';comment:需求类别" json:"-"`
|
||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:联系人" json:"name"`
|
||
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
||
Industry string `gorm:"column:industry;type:varchar(255);comment:所属领域;行业信息" json:"-"`
|
||
Introduce string `gorm:"column:introduce;type:text;comment:需求描述" json:"introduce"`
|
||
Budget float64 `gorm:"column:budget;type:decimal(10,2);default:0;comment:投产预算" json:"budget"`
|
||
BudgetMode TechnologyDemandBudgetMode `gorm:"column:budget_mode;type:tinyint(1);default:1;comment:预算模式(1:具体金额,2:面议)" json:"budget_mode"`
|
||
Deadline time.Time `gorm:"column:deadline;type:date;not null;comment:截止时间" json:"deadline"`
|
||
Other string `gorm:"column:other;type:varchar(255);default:'';comment:其他信息" json:"-"`
|
||
TechnologyStatus
|
||
ModelDeleted
|
||
ModelAt
|
||
}
|
||
|
||
// TechnologyDemandOther 技术需求其他信息
|
||
type TechnologyDemandOther struct {
|
||
Expect []string `json:"expect"` // 期望合作的企业及模式
|
||
Demand struct {
|
||
Basic string `json:"basic"` // 基础
|
||
Expect string `json:"expect"` // 预期
|
||
Benefit string `json:"benefit"` // 效益
|
||
} `json:"demand"` // 需求详细信息
|
||
}
|
||
|
||
// TechnologyDemandBudgetMode 预算模式
|
||
type TechnologyDemandBudgetMode int
|
||
|
||
const (
|
||
// TechnologyDemandBudgetModeForAmount 具体金额
|
||
TechnologyDemandBudgetModeForAmount TechnologyDemandBudgetMode = iota + 1
|
||
// TechnologyDemandBudgetModeForToFace 面议
|
||
TechnologyDemandBudgetModeForToFace
|
||
)
|
||
|
||
func (m *TechnologyDemand) TableName() string {
|
||
return m.NewTableName("technology_demand")
|
||
}
|
||
|
||
func (m *TechnologyDemand) SetKindAttribute(value []string) {
|
||
_bytes, _ := json.Marshal(value)
|
||
m.Kind = string(_bytes)
|
||
}
|
||
|
||
func (m *TechnologyDemand) GetKindAttribute() []string {
|
||
out := make([]string, 0)
|
||
_ = json.Unmarshal([]byte(m.Kind), &out)
|
||
return out
|
||
}
|
||
|
||
func (m *TechnologyDemand) SetIndustryAttribute(value []string) {
|
||
_bytes, _ := json.Marshal(value)
|
||
m.Industry = string(_bytes)
|
||
}
|
||
|
||
func (m *TechnologyDemand) GetIndustryAttribute() []string {
|
||
out := make([]string, 0)
|
||
_ = json.Unmarshal([]byte(m.Industry), &out)
|
||
return out
|
||
}
|
||
|
||
func (m *TechnologyDemand) SetOtherAttribute(value *TechnologyDemandOther) {
|
||
_bytes, _ := json.Marshal(value)
|
||
m.Other = string(_bytes)
|
||
}
|
||
|
||
func (m *TechnologyDemand) GetOtherAttribute() *TechnologyDemandOther {
|
||
other := new(TechnologyDemandOther)
|
||
_ = utils.FromJSON(m.Other, other)
|
||
return other
|
||
}
|
||
|
||
func NewTechnologyDemand() *TechnologyDemand {
|
||
return &TechnologyDemand{}
|
||
}
|