cooperation_application.go
4.9 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package domain
import "time"
// 共创申请实体
type CooperationApplication struct {
// 共创申请ID
CooperationApplicationId int64 `json:"cooperationApplicationId,string"`
// 共创申请人
CooperationApplicationApplicant *User `json:"cooperationApplicationApplicant"`
// 共创申请描述附件
CooperationApplicationAttachment []*Attachment `json:"cooperationApplicationAttachment"`
// 共创申请描述
CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
// 共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationApplicationStatus int32 `json:"cooperationApplicationStatus"`
// 共创申请审核人
CooperationApplicationVerifier *User `json:"cooperationApplicationVerifier"`
// 共创申请审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
// 共创申请审核时间
CooperationApplicationVerifyTime time.Time `json:"cooperationApplicationVerifyTime"`
// 共创申请时间
CooperationApplyTime time.Time `json:"cooperationApplyTime"`
// 共创项目编号
CooperationProject *CooperationProject `json:"cooperationProject"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
type CooperationApplicationRepository interface {
Save(cooperationApplication *CooperationApplication) (*CooperationApplication, error)
Remove(cooperationApplication *CooperationApplication) (*CooperationApplication, error)
FindOne(queryOptions map[string]interface{}) (*CooperationApplication, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationApplication, error)
}
func (cooperationApplication *CooperationApplication) Identify() interface{} {
if cooperationApplication.CooperationApplicationId == 0 {
return nil
}
return cooperationApplication.CooperationApplicationId
}
func (cooperationApplication *CooperationApplication) Update(data map[string]interface{}) error {
if userId, ok := data["userId"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserBaseId = userBaseId.(int64)
}
if orgs, ok := data["orgs"]; ok {
cooperationApplication.CooperationApplicationApplicant.Orgs = orgs.([]*Org)
}
if status, ok := data["status"]; ok {
cooperationApplication.CooperationApplicationApplicant.Status = status.(int32)
}
if cooperationApplicationAttachment, ok := data["cooperationApplicationAttachment"]; ok {
cooperationApplication.CooperationApplicationAttachment = cooperationApplicationAttachment.([]*Attachment)
}
if cooperationApplicationDescription, ok := data["cooperationApplicationDescription"]; ok {
cooperationApplication.CooperationApplicationDescription = cooperationApplicationDescription.(string)
}
if cooperationApplicationStatus, ok := data["cooperationApplicationStatus"]; ok {
cooperationApplication.CooperationApplicationStatus = cooperationApplicationStatus.(int32)
}
if cooperationApplicationVerifyDescription, ok := data["cooperationApplicationVerifyDescription"]; ok {
cooperationApplication.CooperationApplicationVerifyDescription = cooperationApplicationVerifyDescription.(string)
}
if cooperationApplicationVerifyTime, ok := data["cooperationApplicationVerifyTime"]; ok {
cooperationApplication.CooperationApplicationVerifyTime = cooperationApplicationVerifyTime.(time.Time)
}
if cooperationApplyTime, ok := data["cooperationApplyTime"]; ok {
cooperationApplication.CooperationApplyTime = cooperationApplyTime.(time.Time)
}
if cooperationProjectId, ok := data["cooperationProjectId"]; ok {
cooperationApplication.CooperationProject.CooperationProjectId = cooperationProjectId.(int64)
}
if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok {
cooperationApplication.CooperationProject.CooperationProjectNumber = cooperationProjectNumber.(string)
}
if cooperationProjectDescription, ok := data["cooperationProjectDescription"]; ok {
cooperationApplication.CooperationProject.CooperationProjectDescription = cooperationProjectDescription.(string)
}
if cooperationProjectName, ok := data["cooperationProjectName"]; ok {
cooperationApplication.CooperationProject.CooperationProjectName = cooperationProjectName.(string)
}
if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok {
cooperationApplication.CooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time)
}
if operateTime, ok := data["operateTime"]; ok {
cooperationApplication.CooperationProject.OperateTime = operateTime.(time.Time)
}
if status, ok := data["status"]; ok {
cooperationApplication.CooperationProject.Status = status.(int32)
}
return nil
}