cooperation_application.go
7.3 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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 orgId, ok := data["orgId"]; ok {
cooperationApplication.CooperationApplicationApplicant.Org.OrgId = orgId.(int64)
}
if orgName, ok := data["orgName"]; ok {
cooperationApplication.CooperationApplicationApplicant.Org.OrgName = orgName.(string)
}
if companyId, ok := data["companyId"]; ok {
cooperationApplication.CooperationApplicationApplicant.Org.Company.CompanyId = companyId.(int64)
}
if companyLogo, ok := data["companyLogo"]; ok {
cooperationApplication.CooperationApplicationApplicant.Org.Company.CompanyLogo = companyLogo.(string)
}
if companyName, ok := data["companyName"]; ok {
cooperationApplication.CooperationApplicationApplicant.Org.Company.CompanyName = companyName.(string)
}
if orgs, ok := data["orgs"]; ok {
cooperationApplication.CooperationApplicationApplicant.Orgs = orgs.([]*Org)
}
if departmentId, ok := data["departmentId"]; ok {
cooperationApplication.CooperationApplicationApplicant.Department.DepartmentId = departmentId.(int64)
}
if departmentName, ok := data["departmentName"]; ok {
cooperationApplication.CooperationApplicationApplicant.Department.DepartmentName = departmentName.(string)
}
if departmentNumber, ok := data["departmentNumber"]; ok {
cooperationApplication.CooperationApplicationApplicant.Department.DepartmentNumber = departmentNumber.(string)
}
if isOrganization, ok := data["isOrganization"]; ok {
cooperationApplication.CooperationApplicationApplicant.Department.IsOrganization = isOrganization.(bool)
}
if roleId, ok := data["roleId"]; ok {
cooperationApplication.CooperationApplicationApplicant.Role.RoleId = roleId.(int64)
}
if roleName, ok := data["roleName"]; ok {
cooperationApplication.CooperationApplicationApplicant.Role.RoleName = roleName.(string)
}
if userAvatar, ok := data["userAvatar"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserInfo.UserAvatar = userAvatar.(string)
}
if userEmail, ok := data["userEmail"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserInfo.UserEmail = userEmail.(string)
}
if userName, ok := data["userName"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserInfo.UserName = userName.(string)
}
if userPhone, ok := data["userPhone"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserInfo.UserPhone = userPhone.(string)
}
if userAccount, ok := data["userAccount"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserInfo.UserAccount = userAccount.(string)
}
if userType, ok := data["userType"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserType = userType.(int32)
}
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
}