2021-10-14 15:58:51 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"SciencesServer/utils"
|
2021-11-30 10:10:25 +08:00
|
|
|
|
"encoding/json"
|
2021-10-14 15:58:51 +08:00
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// TechnologyDemand 技术需求数据模型
|
|
|
|
|
type TechnologyDemand struct {
|
|
|
|
|
Model
|
|
|
|
|
Local
|
2021-11-30 10:10:25 +08:00
|
|
|
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
2021-12-03 14:18:06 +08:00
|
|
|
|
Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"`
|
|
|
|
|
Kind string `gorm:"column:kind;type:varchar(50);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"`
|
2021-12-23 17:43:27 +08:00
|
|
|
|
Industry string `gorm:"column:industry;type:varchar(255);comment:所属领域;行业信息" json:"-"`
|
2021-10-14 15:58:51 +08:00
|
|
|
|
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"`
|
2021-12-03 14:18:06 +08:00
|
|
|
|
Other string `gorm:"column:other;type:varchar(255);default:'';comment:其他信息" json:"-"`
|
2021-10-14 15:58:51 +08:00
|
|
|
|
Status TechnologyDemandStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
|
|
|
|
|
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
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// TechnologyDemandStatus 需求文档状态
|
|
|
|
|
type TechnologyDemandStatus int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// TechnologyDemandStatusForDraft 草稿箱
|
|
|
|
|
TechnologyDemandStatusForDraft TechnologyDemandStatus = iota
|
|
|
|
|
// TechnologyDemandStatusForExamining 审核中
|
|
|
|
|
TechnologyDemandStatusForExamining
|
|
|
|
|
// TechnologyDemandStatusForAgree 审核通过
|
|
|
|
|
TechnologyDemandStatusForAgree
|
|
|
|
|
// TechnologyDemandStatusForRefuse 审核拒绝
|
|
|
|
|
TechnologyDemandStatusForRefuse
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (m *TechnologyDemand) TableName() string {
|
|
|
|
|
return m.NewTableName("technology_demand")
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 10:10:25 +08:00
|
|
|
|
func (m *TechnologyDemand) SetKindAttribute(value []string) {
|
|
|
|
|
_bytes, _ := json.Marshal(value)
|
|
|
|
|
m.Kind = string(_bytes)
|
2021-10-14 15:58:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TechnologyDemand) GetKindAttribute() []string {
|
2021-11-30 10:10:25 +08:00
|
|
|
|
out := make([]string, 0)
|
|
|
|
|
_ = json.Unmarshal([]byte(m.Kind), &out)
|
|
|
|
|
return out
|
2021-10-14 15:58:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 10:10:25 +08:00
|
|
|
|
func (m *TechnologyDemand) SetIndustryAttribute(value []string) {
|
|
|
|
|
_bytes, _ := json.Marshal(value)
|
|
|
|
|
m.Industry = string(_bytes)
|
2021-10-14 15:58:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TechnologyDemand) GetIndustryAttribute() []string {
|
2021-11-30 10:10:25 +08:00
|
|
|
|
out := make([]string, 0)
|
|
|
|
|
_ = json.Unmarshal([]byte(m.Industry), &out)
|
|
|
|
|
return out
|
2021-10-14 15:58:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 10:10:25 +08:00
|
|
|
|
func (m *TechnologyDemand) SetOtherAttribute(value *TechnologyDemandOther) {
|
|
|
|
|
_bytes, _ := json.Marshal(value)
|
|
|
|
|
m.Other = string(_bytes)
|
2021-10-14 15:58:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TechnologyDemand) GetOtherAttribute() *TechnologyDemandOther {
|
|
|
|
|
other := new(TechnologyDemandOther)
|
|
|
|
|
_ = utils.FromJSON(m.Other, other)
|
|
|
|
|
return other
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewTechnologyDemand() *TechnologyDemand {
|
|
|
|
|
return &TechnologyDemand{}
|
|
|
|
|
}
|