78 lines
2.7 KiB
Go
78 lines
2.7 KiB
Go
![]() |
package model
|
|||
|
|
|||
|
import (
|
|||
|
"SciencesServer/utils"
|
|||
|
"fmt"
|
|||
|
"strings"
|
|||
|
)
|
|||
|
|
|||
|
// ManageCooperateEnterprise 企业数据模型管理
|
|||
|
type ManageCooperateEnterprise struct {
|
|||
|
Model
|
|||
|
ModelTenant
|
|||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
|||
|
Mode ManageCooperateEnterpriseMode `gorm:"column:mode;type:int;default:0;comment:合作模式(1:已合作,2:想合作)" json:"mode"`
|
|||
|
Name string `gorm:"column:name;type:varchar(30);default:'';comment:企业名称" json:"name"`
|
|||
|
Contact string `gorm:"column:contact;type:varchar(50);default:'';comment:企业联系人" json:"contact"`
|
|||
|
ContactMobile string `gorm:"column:contact_mobile;type:varchar(20);default:'';comment:企业联系方式" json:"contact_mobile"`
|
|||
|
Paper string `gorm:"column:paper;type:varchar(255);default:'';comment:论文信息" json:"-"`
|
|||
|
Patent string `gorm:"column:patent;type:varchar(255);default:'';comment:专利信息" json:"-"`
|
|||
|
Content string `gorm:"column:content;type:varchar(255);default:'';comment:合作内容" json:"content"`
|
|||
|
ModelDeleted
|
|||
|
ModelAt
|
|||
|
}
|
|||
|
|
|||
|
// ManageCooperateEnterpriseMode 用户企业合作模式
|
|||
|
type ManageCooperateEnterpriseMode int
|
|||
|
|
|||
|
const (
|
|||
|
// ManageCooperateEnterpriseModeForCooperateAlready 已合作
|
|||
|
ManageCooperateEnterpriseModeForCooperateAlready ManageCooperateEnterpriseMode = iota + 1
|
|||
|
// ManageCooperateEnterpriseModeForCooperateToWant 想合作
|
|||
|
ManageCooperateEnterpriseModeForCooperateToWant
|
|||
|
)
|
|||
|
|
|||
|
func (m *ManageCooperateEnterprise) TableName() string {
|
|||
|
return "manage_cooperate_enterprise"
|
|||
|
}
|
|||
|
|
|||
|
func (m *ManageCooperateEnterprise) GetPaperAttribute() []string {
|
|||
|
out := make([]string, 0)
|
|||
|
|
|||
|
for _, v := range strings.Split(m.Paper, ",") {
|
|||
|
out = append(out, (&Model{ID: utils.StringToUnit64(v)}).GetEncodeID())
|
|||
|
}
|
|||
|
return out
|
|||
|
}
|
|||
|
|
|||
|
func (m *ManageCooperateEnterprise) SetPaperAttribute(value []uint64) {
|
|||
|
out := make([]string, 0)
|
|||
|
|
|||
|
for _, v := range value {
|
|||
|
out = append(out, fmt.Sprintf("%d", v))
|
|||
|
}
|
|||
|
m.Paper = strings.Join(out, ",")
|
|||
|
}
|
|||
|
|
|||
|
func (m *ManageCooperateEnterprise) GetPatentAttribute() []string {
|
|||
|
out := make([]string, 0)
|
|||
|
|
|||
|
for _, v := range strings.Split(m.Patent, ",") {
|
|||
|
out = append(out, (&Model{ID: utils.StringToUnit64(v)}).GetEncodeID())
|
|||
|
}
|
|||
|
return out
|
|||
|
}
|
|||
|
|
|||
|
func (m *ManageCooperateEnterprise) SetPatentAttribute(value []uint64) {
|
|||
|
out := make([]string, 0)
|
|||
|
|
|||
|
for _, v := range value {
|
|||
|
out = append(out, fmt.Sprintf("%d", v))
|
|||
|
}
|
|||
|
m.Patent = strings.Join(out, ",")
|
|||
|
}
|
|||
|
|
|||
|
func NewManageCooperateEnterprise() *ManageCooperateEnterprise {
|
|||
|
return &ManageCooperateEnterprise{}
|
|||
|
}
|