cooperation_project.go
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package domain
import "time"
// CooperationProject 共创项目实体
type CooperationProject struct {
// 共创项目ID
CooperationProjectId int64 `json:"cooperationProjectId,string"`
// 共创项目编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName"`
// 共创项目发布时间
CooperationProjectPublishTime time.Time `json:"cooperationProjectPublishTime"`
// 共创项目发布人
CooperationProjectPublisher *User `json:"cooperationProjectPublisher"`
// 共创项目发起人
CooperationProjectSponsor *User `json:"cooperationProjectSponsor"`
// 共创模式
CooperationMode *CooperationMode `json:"cooperationMode"`
// 共创项目发起部门
Department *Department `json:"department"`
// 共创项目承接对象,1员工,2共创用户,3公开,可以多选
CooperationProjectUndertakerTypes []int32 `json:"cooperationProjectUndertakerTypes"`
// 数据所属组织机构
Org *Org `json:"org"`
// 图片附件
Attachment []*Attachment `json:"attachment"`
// 公司
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 共创项目状态,1招标中,2结束
Status int32 `json:"status"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
}
type CooperationProjectRepository interface {
Save(cooperationProject *CooperationProject) (*CooperationProject, error)
Remove(cooperationProject *CooperationProject) (*CooperationProject, error)
FindOne(queryOptions map[string]interface{}) (*CooperationProject, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationProject, error)
}
func (cooperationProject *CooperationProject) Identify() interface{} {
if cooperationProject.CooperationProjectId == 0 {
return nil
}
return cooperationProject.CooperationProjectId
}
func (cooperationProject *CooperationProject) Update(data map[string]interface{}) error {
if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok {
cooperationProject.CooperationProjectNumber = cooperationProjectNumber.(string)
}
if cooperationProjectDescription, ok := data["cooperationProjectDescription"]; ok {
cooperationProject.CooperationProjectDescription = cooperationProjectDescription.(string)
}
if cooperationProjectName, ok := data["cooperationProjectName"]; ok {
cooperationProject.CooperationProjectName = cooperationProjectName.(string)
}
if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok {
cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time)
}
if cooperationProjectUndertakerTypes, ok := data["cooperationProjectUndertakerTypes"]; ok {
cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerTypes.([]int32)
}
if operateTime, ok := data["operateTime"]; ok {
cooperationProject.OperateTime = operateTime.(time.Time)
}
if status, ok := data["status"]; ok {
cooperationProject.Status = status.(int32)
}
return nil
}