正在显示
13 个修改的文件
包含
267 行增加
和
78 行删除
@@ -26,6 +26,8 @@ type CooperationApplication struct { | @@ -26,6 +26,8 @@ type CooperationApplication struct { | ||
26 | CooperationProject *CooperationProject `json:"cooperationProject"` | 26 | CooperationProject *CooperationProject `json:"cooperationProject"` |
27 | // 数据所属组织机构 | 27 | // 数据所属组织机构 |
28 | Org *Org `json:"org"` | 28 | Org *Org `json:"org"` |
29 | + // 是否被取消标志位 | ||
30 | + IsCanceled bool `json:"isCanceled"` | ||
29 | // 公司 | 31 | // 公司 |
30 | Company *Company `json:"company"` | 32 | Company *Company `json:"company"` |
31 | // 创建时间 | 33 | // 创建时间 |
@@ -22,6 +22,8 @@ type CooperationProject struct { | @@ -22,6 +22,8 @@ type CooperationProject struct { | ||
22 | CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType"` | 22 | CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType"` |
23 | // 数据所属组织机构 | 23 | // 数据所属组织机构 |
24 | Org *Org `json:"org"` | 24 | Org *Org `json:"org"` |
25 | + // 图片附件 | ||
26 | + Attachment *Attachment `json:"attachment"` | ||
25 | // 公司 | 27 | // 公司 |
26 | Company *Company `json:"company"` | 28 | Company *Company `json:"company"` |
27 | // 操作人 | 29 | // 操作人 |
@@ -161,14 +163,5 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{} | @@ -161,14 +163,5 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{} | ||
161 | if status, ok := data["status"]; ok { | 163 | if status, ok := data["status"]; ok { |
162 | cooperationProject.Status = status.(int32) | 164 | cooperationProject.Status = status.(int32) |
163 | } | 165 | } |
164 | - if updatedAt, ok := data["updatedAt"]; ok { | ||
165 | - cooperationProject.UpdatedAt = updatedAt.(time.Time) | ||
166 | - } | ||
167 | - if deletedAt, ok := data["deletedAt"]; ok { | ||
168 | - cooperationProject.DeletedAt = deletedAt.(time.Time) | ||
169 | - } | ||
170 | - if createdAt, ok := data["createdAt"]; ok { | ||
171 | - cooperationProject.CreatedAt = createdAt.(time.Time) | ||
172 | - } | ||
173 | return nil | 166 | return nil |
174 | } | 167 | } |
@@ -18,6 +18,10 @@ type Undertaker struct { | @@ -18,6 +18,10 @@ type Undertaker struct { | ||
18 | UserInfo *UserInfo `json:"userInfo"` | 18 | UserInfo *UserInfo `json:"userInfo"` |
19 | // 用户类型,1员工,2共创用户,3公开 | 19 | // 用户类型,1员工,2共创用户,3公开 |
20 | UserType int32 `json:"userType"` | 20 | UserType int32 `json:"userType"` |
21 | + // 推荐人 | ||
22 | + Referrer *Referrer `json:"referrer"` | ||
23 | + // 关联业务员 | ||
24 | + Salesman *Salesman `json:"salesman"` | ||
21 | // 状态 | 25 | // 状态 |
22 | Status int32 `json:"status"` | 26 | Status int32 `json:"status"` |
23 | // 公司 | 27 | // 公司 |
@@ -29,6 +29,8 @@ type CooperationApplication struct { | @@ -29,6 +29,8 @@ type CooperationApplication struct { | ||
29 | CooperationProjectNumber string `comment:"共创项目编号"` | 29 | CooperationProjectNumber string `comment:"共创项目编号"` |
30 | // 数据所属组织机构 | 30 | // 数据所属组织机构 |
31 | Org *domain.Org `comment:"数据所属组织机构"` | 31 | Org *domain.Org `comment:"数据所属组织机构"` |
32 | + // 是否被取消标志位 | ||
33 | + IsCanceled bool `comment:"是否被取消标志位"` | ||
32 | // 公司 | 34 | // 公司 |
33 | Company *domain.Company `comment:"公司"` | 35 | Company *domain.Company `comment:"公司"` |
34 | // 创建时间 | 36 | // 创建时间 |
@@ -11,8 +11,32 @@ type CooperationContractUndertaker struct { | @@ -11,8 +11,32 @@ type CooperationContractUndertaker struct { | ||
11 | CooperationContractUndertakerId int64 `comment:"共创合约承接人id" pg:"pk:cooperation_contract_undertaker_id"` | 11 | CooperationContractUndertakerId int64 `comment:"共创合约承接人id" pg:"pk:cooperation_contract_undertaker_id"` |
12 | // 共创合约编号 | 12 | // 共创合约编号 |
13 | CooperationContractNumber string `comment:"共创合约编号"` | 13 | CooperationContractNumber string `comment:"共创合约编号"` |
14 | - // 共创合约承接人 | ||
15 | - Undertaker *domain.Undertaker `comment:"共创合约承接人"` | 14 | + // 共创合约承接人uid |
15 | + UserId int64 `comment:"共创合约承接人uid"` | ||
16 | + // 用户基础数据id | ||
17 | + UserBaseId int64 `comment:"用户基础数据id"` | ||
18 | + // 所属组织机构 | ||
19 | + Org *domain.Org `comment:"所属组织机构"` | ||
20 | + // 关联的组织机构 | ||
21 | + Orgs []*domain.Org `comment:"关联的组织机构"` | ||
22 | + // 用户所属部门 | ||
23 | + Department *domain.Department `comment:"用户所属部门"` | ||
24 | + // 用户角色 | ||
25 | + Role *domain.Role `comment:"用户角色"` | ||
26 | + // 用户信息 | ||
27 | + UserInfo *domain.UserInfo `comment:"用户信息"` | ||
28 | + // 用户类型 | ||
29 | + UserType int32 `comment:"用户类型"` | ||
30 | + // 推荐人 | ||
31 | + Referrer *domain.Referrer `comment:"推荐人"` | ||
32 | + // 关联的业务员 | ||
33 | + Salesman *domain.Salesman `comment:"关联的业务员"` | ||
34 | + // 人员状态 | ||
35 | + Status int32 `comment:"人员状态"` | ||
36 | + // 公司信息 | ||
37 | + Company *domain.Company `comment:"公司信息"` | ||
38 | + // 合同附件 | ||
39 | + ContractAttachment []*domain.Attachment `comment:"合约附件"` | ||
16 | // 创建时间 | 40 | // 创建时间 |
17 | CreatedAt time.Time `comment:"创建时间"` | 41 | CreatedAt time.Time `comment:"创建时间"` |
18 | // 更新时间 | 42 | // 更新时间 |
@@ -36,10 +36,11 @@ func TransformToCooperationApplicationDomainModelFromPgModels( | @@ -36,10 +36,11 @@ func TransformToCooperationApplicationDomainModelFromPgModels( | ||
36 | DeletedAt: cooperationProject.DeletedAt, | 36 | DeletedAt: cooperationProject.DeletedAt, |
37 | CreatedAt: cooperationProject.CreatedAt, | 37 | CreatedAt: cooperationProject.CreatedAt, |
38 | }, | 38 | }, |
39 | - Org: cooperationApplicationModel.Org, | ||
40 | - Company: cooperationApplicationModel.Company, | ||
41 | - CreatedAt: cooperationApplicationModel.CreatedAt, | ||
42 | - DeletedAt: cooperationApplicationModel.DeletedAt, | ||
43 | - UpdatedAt: cooperationApplicationModel.UpdatedAt, | 39 | + Org: cooperationApplicationModel.Org, |
40 | + IsCanceled: cooperationApplicationModel.IsCanceled, | ||
41 | + Company: cooperationApplicationModel.Company, | ||
42 | + CreatedAt: cooperationApplicationModel.CreatedAt, | ||
43 | + DeletedAt: cooperationApplicationModel.DeletedAt, | ||
44 | + UpdatedAt: cooperationApplicationModel.UpdatedAt, | ||
44 | }, nil | 45 | }, nil |
45 | } | 46 | } |
@@ -9,9 +9,23 @@ func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperation | @@ -9,9 +9,23 @@ func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperation | ||
9 | return &domain.CooperationContractUndertaker{ | 9 | return &domain.CooperationContractUndertaker{ |
10 | CooperationContractUndertakerId: cooperationContractUndertakerModel.CooperationContractUndertakerId, | 10 | CooperationContractUndertakerId: cooperationContractUndertakerModel.CooperationContractUndertakerId, |
11 | CooperationContractNumber: cooperationContractUndertakerModel.CooperationContractNumber, | 11 | CooperationContractNumber: cooperationContractUndertakerModel.CooperationContractNumber, |
12 | - Undertaker: cooperationContractUndertakerModel.Undertaker, | ||
13 | - CreatedAt: cooperationContractUndertakerModel.CreatedAt, | ||
14 | - UpdatedAt: cooperationContractUndertakerModel.UpdatedAt, | ||
15 | - DeletedAt: cooperationContractUndertakerModel.DeletedAt, | 12 | + Undertaker: &domain.Undertaker{ |
13 | + UserId: cooperationContractUndertakerModel.UserId, | ||
14 | + UserBaseId: cooperationContractUndertakerModel.UserBaseId, | ||
15 | + Org: cooperationContractUndertakerModel.Org, | ||
16 | + Orgs: cooperationContractUndertakerModel.Orgs, | ||
17 | + Department: cooperationContractUndertakerModel.Department, | ||
18 | + Role: cooperationContractUndertakerModel.Role, | ||
19 | + UserInfo: cooperationContractUndertakerModel.UserInfo, | ||
20 | + UserType: cooperationContractUndertakerModel.UserType, | ||
21 | + Referrer: cooperationContractUndertakerModel.Referrer, | ||
22 | + Salesman: cooperationContractUndertakerModel.Salesman, | ||
23 | + Status: cooperationContractUndertakerModel.Status, | ||
24 | + Company: cooperationContractUndertakerModel.Company, | ||
25 | + ContractAttachment: cooperationContractUndertakerModel.ContractAttachment, | ||
26 | + }, | ||
27 | + CreatedAt: cooperationContractUndertakerModel.CreatedAt, | ||
28 | + UpdatedAt: cooperationContractUndertakerModel.UpdatedAt, | ||
29 | + DeletedAt: cooperationContractUndertakerModel.DeletedAt, | ||
16 | }, nil | 30 | }, nil |
17 | } | 31 | } |
@@ -54,7 +54,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -54,7 +54,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
54 | if _, err := tx.QueryOne( | 54 | if _, err := tx.QueryOne( |
55 | pg.Scan( | 55 | pg.Scan( |
56 | &contractUndertakerFeedback.FeedbackId, | 56 | &contractUndertakerFeedback.FeedbackId, |
57 | - pg.Array(&contractUndertakerFeedback.FeedbackAttachment), | 57 | + &contractUndertakerFeedback.FeedbackAttachment, |
58 | &contractUndertakerFeedback.FeedbackContent, | 58 | &contractUndertakerFeedback.FeedbackContent, |
59 | &contractUndertakerFeedback.CooperationContractNumber, | 59 | &contractUndertakerFeedback.CooperationContractNumber, |
60 | &contractUndertakerFeedback.ContractUndertaker, | 60 | &contractUndertakerFeedback.ContractUndertaker, |
@@ -67,7 +67,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -67,7 +67,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
67 | ), | 67 | ), |
68 | fmt.Sprintf("INSERT INTO contract_undertaker_feedbacks (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 68 | fmt.Sprintf("INSERT INTO contract_undertaker_feedbacks (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
69 | contractUndertakerFeedback.FeedbackId, | 69 | contractUndertakerFeedback.FeedbackId, |
70 | - pg.Array(contractUndertakerFeedback.FeedbackAttachment), | 70 | + contractUndertakerFeedback.FeedbackAttachment, |
71 | contractUndertakerFeedback.FeedbackContent, | 71 | contractUndertakerFeedback.FeedbackContent, |
72 | contractUndertakerFeedback.CooperationContractNumber, | 72 | contractUndertakerFeedback.CooperationContractNumber, |
73 | contractUndertakerFeedback.ContractUndertaker, | 73 | contractUndertakerFeedback.ContractUndertaker, |
@@ -84,7 +84,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -84,7 +84,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
84 | if _, err := tx.QueryOne( | 84 | if _, err := tx.QueryOne( |
85 | pg.Scan( | 85 | pg.Scan( |
86 | &contractUndertakerFeedback.FeedbackId, | 86 | &contractUndertakerFeedback.FeedbackId, |
87 | - pg.Array(&contractUndertakerFeedback.FeedbackAttachment), | 87 | + &contractUndertakerFeedback.FeedbackAttachment, |
88 | &contractUndertakerFeedback.FeedbackContent, | 88 | &contractUndertakerFeedback.FeedbackContent, |
89 | &contractUndertakerFeedback.CooperationContractNumber, | 89 | &contractUndertakerFeedback.CooperationContractNumber, |
90 | &contractUndertakerFeedback.ContractUndertaker, | 90 | &contractUndertakerFeedback.ContractUndertaker, |
@@ -97,7 +97,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -97,7 +97,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
97 | ), | 97 | ), |
98 | fmt.Sprintf("UPDATE contract_undertaker_feedbacks SET %s WHERE contract_undertaker_feedback_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 98 | fmt.Sprintf("UPDATE contract_undertaker_feedbacks SET %s WHERE contract_undertaker_feedback_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
99 | contractUndertakerFeedback.FeedbackId, | 99 | contractUndertakerFeedback.FeedbackId, |
100 | - pg.Array(contractUndertakerFeedback.FeedbackAttachment), | 100 | + contractUndertakerFeedback.FeedbackAttachment, |
101 | contractUndertakerFeedback.FeedbackContent, | 101 | contractUndertakerFeedback.FeedbackContent, |
102 | contractUndertakerFeedback.CooperationContractNumber, | 102 | contractUndertakerFeedback.CooperationContractNumber, |
103 | contractUndertakerFeedback.ContractUndertaker, | 103 | contractUndertakerFeedback.ContractUndertaker, |
@@ -37,6 +37,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -37,6 +37,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
37 | "cooperation_apply_time", | 37 | "cooperation_apply_time", |
38 | "cooperation_project", | 38 | "cooperation_project", |
39 | "org", | 39 | "org", |
40 | + "isCanceled", | ||
40 | "company", | 41 | "company", |
41 | "created_at", | 42 | "created_at", |
42 | "deleted_at", | 43 | "deleted_at", |
@@ -68,6 +69,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -68,6 +69,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
68 | &cooperationApplication.CooperationApplyTime, | 69 | &cooperationApplication.CooperationApplyTime, |
69 | &cooperationApplication.CooperationProject, | 70 | &cooperationApplication.CooperationProject, |
70 | &cooperationApplication.Org, | 71 | &cooperationApplication.Org, |
72 | + &cooperationApplication.IsCanceled, | ||
71 | &cooperationApplication.Company, | 73 | &cooperationApplication.Company, |
72 | &cooperationApplication.CreatedAt, | 74 | &cooperationApplication.CreatedAt, |
73 | &cooperationApplication.DeletedAt, | 75 | &cooperationApplication.DeletedAt, |
@@ -76,7 +78,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -76,7 +78,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
76 | fmt.Sprintf("INSERT INTO cooperation_applications (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 78 | fmt.Sprintf("INSERT INTO cooperation_applications (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
77 | cooperationApplication.CooperationApplicationId, | 79 | cooperationApplication.CooperationApplicationId, |
78 | cooperationApplication.CooperationApplicationApplicant, | 80 | cooperationApplication.CooperationApplicationApplicant, |
79 | - pg.Array(cooperationApplication.CooperationApplicationAttachment), | 81 | + cooperationApplication.CooperationApplicationAttachment, |
80 | cooperationApplication.CooperationApplicationDescription, | 82 | cooperationApplication.CooperationApplicationDescription, |
81 | cooperationApplication.CooperationApplicationStatus, | 83 | cooperationApplication.CooperationApplicationStatus, |
82 | cooperationApplication.CooperationApplicationVerifier, | 84 | cooperationApplication.CooperationApplicationVerifier, |
@@ -85,6 +87,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -85,6 +87,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
85 | cooperationApplication.CooperationApplyTime, | 87 | cooperationApplication.CooperationApplyTime, |
86 | cooperationApplication.CooperationProject, | 88 | cooperationApplication.CooperationProject, |
87 | cooperationApplication.Org, | 89 | cooperationApplication.Org, |
90 | + cooperationApplication.IsCanceled, | ||
88 | cooperationApplication.Company, | 91 | cooperationApplication.Company, |
89 | cooperationApplication.CreatedAt, | 92 | cooperationApplication.CreatedAt, |
90 | cooperationApplication.DeletedAt, | 93 | cooperationApplication.DeletedAt, |
@@ -97,7 +100,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -97,7 +100,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
97 | pg.Scan( | 100 | pg.Scan( |
98 | &cooperationApplication.CooperationApplicationId, | 101 | &cooperationApplication.CooperationApplicationId, |
99 | &cooperationApplication.CooperationApplicationApplicant, | 102 | &cooperationApplication.CooperationApplicationApplicant, |
100 | - pg.Array(&cooperationApplication.CooperationApplicationAttachment), | 103 | + &cooperationApplication.CooperationApplicationAttachment, |
101 | &cooperationApplication.CooperationApplicationDescription, | 104 | &cooperationApplication.CooperationApplicationDescription, |
102 | &cooperationApplication.CooperationApplicationStatus, | 105 | &cooperationApplication.CooperationApplicationStatus, |
103 | &cooperationApplication.CooperationApplicationVerifier, | 106 | &cooperationApplication.CooperationApplicationVerifier, |
@@ -106,6 +109,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -106,6 +109,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
106 | &cooperationApplication.CooperationApplyTime, | 109 | &cooperationApplication.CooperationApplyTime, |
107 | &cooperationApplication.CooperationProject, | 110 | &cooperationApplication.CooperationProject, |
108 | &cooperationApplication.Org, | 111 | &cooperationApplication.Org, |
112 | + &cooperationApplication.IsCanceled, | ||
109 | &cooperationApplication.Company, | 113 | &cooperationApplication.Company, |
110 | &cooperationApplication.CreatedAt, | 114 | &cooperationApplication.CreatedAt, |
111 | &cooperationApplication.DeletedAt, | 115 | &cooperationApplication.DeletedAt, |
@@ -114,7 +118,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -114,7 +118,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
114 | fmt.Sprintf("UPDATE cooperation_applications SET %s WHERE cooperation_application_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 118 | fmt.Sprintf("UPDATE cooperation_applications SET %s WHERE cooperation_application_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
115 | cooperationApplication.CooperationApplicationId, | 119 | cooperationApplication.CooperationApplicationId, |
116 | cooperationApplication.CooperationApplicationApplicant, | 120 | cooperationApplication.CooperationApplicationApplicant, |
117 | - pg.Array(cooperationApplication.CooperationApplicationAttachment), | 121 | + cooperationApplication.CooperationApplicationAttachment, |
118 | cooperationApplication.CooperationApplicationDescription, | 122 | cooperationApplication.CooperationApplicationDescription, |
119 | cooperationApplication.CooperationApplicationStatus, | 123 | cooperationApplication.CooperationApplicationStatus, |
120 | cooperationApplication.CooperationApplicationVerifier, | 124 | cooperationApplication.CooperationApplicationVerifier, |
@@ -123,6 +127,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | @@ -123,6 +127,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication | ||
123 | cooperationApplication.CooperationApplyTime, | 127 | cooperationApplication.CooperationApplyTime, |
124 | cooperationApplication.CooperationProject, | 128 | cooperationApplication.CooperationProject, |
125 | cooperationApplication.Org, | 129 | cooperationApplication.Org, |
130 | + cooperationApplication.IsCanceled, | ||
126 | cooperationApplication.Company, | 131 | cooperationApplication.Company, |
127 | cooperationApplication.CreatedAt, | 132 | cooperationApplication.CreatedAt, |
128 | cooperationApplication.DeletedAt, | 133 | cooperationApplication.DeletedAt, |
@@ -28,7 +28,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | @@ -28,7 +28,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | ||
28 | sqlBuildFields := []string{ | 28 | sqlBuildFields := []string{ |
29 | "cooperation_contract_relevant_id", | 29 | "cooperation_contract_relevant_id", |
30 | "cooperation_contract_number", | 30 | "cooperation_contract_number", |
31 | - "relevant", | 31 | + "user_id", |
32 | + "user_base_id", | ||
33 | + "org", | ||
34 | + "orgs", | ||
35 | + "department", | ||
36 | + "role", | ||
37 | + "user_info", | ||
38 | + "user_type", | ||
39 | + "status", | ||
40 | + "company", | ||
32 | "updated_at", | 41 | "updated_at", |
33 | "deleted_at", | 42 | "deleted_at", |
34 | "created_at", | 43 | "created_at", |
@@ -50,7 +59,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | @@ -50,7 +59,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | ||
50 | pg.Scan( | 59 | pg.Scan( |
51 | &cooperationContractRelevant.CooperationContractRelevantId, | 60 | &cooperationContractRelevant.CooperationContractRelevantId, |
52 | &cooperationContractRelevant.CooperationContractNumber, | 61 | &cooperationContractRelevant.CooperationContractNumber, |
53 | - &cooperationContractRelevant.Relevant, | 62 | + &cooperationContractRelevant.Relevant.UserId, |
63 | + &cooperationContractRelevant.Relevant.UserBaseId, | ||
64 | + &cooperationContractRelevant.Relevant.Org, | ||
65 | + &cooperationContractRelevant.Relevant.Orgs, | ||
66 | + &cooperationContractRelevant.Relevant.Department, | ||
67 | + &cooperationContractRelevant.Relevant.Role, | ||
68 | + &cooperationContractRelevant.Relevant.UserInfo, | ||
69 | + &cooperationContractRelevant.Relevant.UserType, | ||
70 | + &cooperationContractRelevant.Relevant.Status, | ||
71 | + &cooperationContractRelevant.Relevant.Company, | ||
54 | &cooperationContractRelevant.UpdatedAt, | 72 | &cooperationContractRelevant.UpdatedAt, |
55 | &cooperationContractRelevant.DeletedAt, | 73 | &cooperationContractRelevant.DeletedAt, |
56 | &cooperationContractRelevant.CreatedAt, | 74 | &cooperationContractRelevant.CreatedAt, |
@@ -58,7 +76,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | @@ -58,7 +76,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | ||
58 | fmt.Sprintf("INSERT INTO cooperation_contract_relevants (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 76 | fmt.Sprintf("INSERT INTO cooperation_contract_relevants (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
59 | cooperationContractRelevant.CooperationContractRelevantId, | 77 | cooperationContractRelevant.CooperationContractRelevantId, |
60 | cooperationContractRelevant.CooperationContractNumber, | 78 | cooperationContractRelevant.CooperationContractNumber, |
61 | - cooperationContractRelevant.Relevant, | 79 | + &cooperationContractRelevant.Relevant.UserId, |
80 | + &cooperationContractRelevant.Relevant.UserBaseId, | ||
81 | + &cooperationContractRelevant.Relevant.Org, | ||
82 | + &cooperationContractRelevant.Relevant.Orgs, | ||
83 | + &cooperationContractRelevant.Relevant.Department, | ||
84 | + &cooperationContractRelevant.Relevant.Role, | ||
85 | + &cooperationContractRelevant.Relevant.UserInfo, | ||
86 | + &cooperationContractRelevant.Relevant.UserType, | ||
87 | + &cooperationContractRelevant.Relevant.Status, | ||
88 | + &cooperationContractRelevant.Relevant.Company, | ||
62 | cooperationContractRelevant.UpdatedAt, | 89 | cooperationContractRelevant.UpdatedAt, |
63 | cooperationContractRelevant.DeletedAt, | 90 | cooperationContractRelevant.DeletedAt, |
64 | cooperationContractRelevant.CreatedAt, | 91 | cooperationContractRelevant.CreatedAt, |
@@ -70,7 +97,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | @@ -70,7 +97,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | ||
70 | pg.Scan( | 97 | pg.Scan( |
71 | &cooperationContractRelevant.CooperationContractRelevantId, | 98 | &cooperationContractRelevant.CooperationContractRelevantId, |
72 | &cooperationContractRelevant.CooperationContractNumber, | 99 | &cooperationContractRelevant.CooperationContractNumber, |
73 | - &cooperationContractRelevant.Relevant, | 100 | + &cooperationContractRelevant.Relevant.UserId, |
101 | + &cooperationContractRelevant.Relevant.UserBaseId, | ||
102 | + &cooperationContractRelevant.Relevant.Org, | ||
103 | + &cooperationContractRelevant.Relevant.Orgs, | ||
104 | + &cooperationContractRelevant.Relevant.Department, | ||
105 | + &cooperationContractRelevant.Relevant.Role, | ||
106 | + &cooperationContractRelevant.Relevant.UserInfo, | ||
107 | + &cooperationContractRelevant.Relevant.UserType, | ||
108 | + &cooperationContractRelevant.Relevant.Status, | ||
109 | + &cooperationContractRelevant.Relevant.Company, | ||
74 | &cooperationContractRelevant.UpdatedAt, | 110 | &cooperationContractRelevant.UpdatedAt, |
75 | &cooperationContractRelevant.DeletedAt, | 111 | &cooperationContractRelevant.DeletedAt, |
76 | &cooperationContractRelevant.CreatedAt, | 112 | &cooperationContractRelevant.CreatedAt, |
@@ -78,7 +114,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | @@ -78,7 +114,16 @@ func (repository *CooperationContractRelevantRepository) Save(cooperationContrac | ||
78 | fmt.Sprintf("UPDATE cooperation_contract_relevants SET %s WHERE cooperation_contract_relevant_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 114 | fmt.Sprintf("UPDATE cooperation_contract_relevants SET %s WHERE cooperation_contract_relevant_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
79 | cooperationContractRelevant.CooperationContractRelevantId, | 115 | cooperationContractRelevant.CooperationContractRelevantId, |
80 | cooperationContractRelevant.CooperationContractNumber, | 116 | cooperationContractRelevant.CooperationContractNumber, |
81 | - cooperationContractRelevant.Relevant, | 117 | + cooperationContractRelevant.Relevant.UserId, |
118 | + cooperationContractRelevant.Relevant.UserBaseId, | ||
119 | + cooperationContractRelevant.Relevant.Org, | ||
120 | + cooperationContractRelevant.Relevant.Orgs, | ||
121 | + cooperationContractRelevant.Relevant.Department, | ||
122 | + cooperationContractRelevant.Relevant.Role, | ||
123 | + cooperationContractRelevant.Relevant.UserInfo, | ||
124 | + cooperationContractRelevant.Relevant.UserType, | ||
125 | + cooperationContractRelevant.Relevant.Status, | ||
126 | + cooperationContractRelevant.Relevant.Company, | ||
82 | cooperationContractRelevant.UpdatedAt, | 127 | cooperationContractRelevant.UpdatedAt, |
83 | cooperationContractRelevant.DeletedAt, | 128 | cooperationContractRelevant.DeletedAt, |
84 | cooperationContractRelevant.CreatedAt, | 129 | cooperationContractRelevant.CreatedAt, |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/transform" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/transform" |
12 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" | ||
12 | "time" | 13 | "time" |
13 | ) | 14 | ) |
14 | 15 | ||
@@ -127,7 +128,19 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -127,7 +128,19 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
127 | for _, undertaker := range cooperationContract.Undertakers { | 128 | for _, undertaker := range cooperationContract.Undertakers { |
128 | undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{ | 129 | undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{ |
129 | CooperationContractNumber: cooperationContract.CooperationContractNumber, | 130 | CooperationContractNumber: cooperationContract.CooperationContractNumber, |
130 | - Undertaker: undertaker, | 131 | + UserId: undertaker.UserId, |
132 | + UserBaseId: undertaker.UserBaseId, | ||
133 | + Org: undertaker.Org, | ||
134 | + Orgs: undertaker.Orgs, | ||
135 | + Department: undertaker.Department, | ||
136 | + Role: undertaker.Role, | ||
137 | + UserInfo: undertaker.UserInfo, | ||
138 | + UserType: undertaker.UserType, | ||
139 | + Referrer: undertaker.Referrer, | ||
140 | + Salesman: undertaker.Salesman, | ||
141 | + Status: undertaker.Status, | ||
142 | + Company: undertaker.Company, | ||
143 | + ContractAttachment: undertaker.ContractAttachment, | ||
131 | CreatedAt: time.Time{}, | 144 | CreatedAt: time.Time{}, |
132 | UpdatedAt: time.Time{}, | 145 | UpdatedAt: time.Time{}, |
133 | DeletedAt: time.Now(), | 146 | DeletedAt: time.Now(), |
@@ -224,20 +237,26 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -224,20 +237,26 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
224 | return cooperationContract, err | 237 | return cooperationContract, err |
225 | } | 238 | } |
226 | 239 | ||
227 | - // TODO 更新相关人 | 240 | + // 更新相关人 |
241 | + | ||
228 | // 查找相关人列表 | 242 | // 查找相关人列表 |
229 | - var cooperationContractRelevantFetched []*models.CooperationContractRelevant | ||
230 | - cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantFetched) | 243 | + var cooperationContractRelevantModelsFetched []*models.CooperationContractRelevant |
244 | + cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModelsFetched) | ||
231 | if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 245 | if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { |
232 | return nil, err | 246 | return nil, err |
233 | } | 247 | } |
234 | 248 | ||
249 | + // 提取相关人id | ||
250 | + var cooperationContractRelevantIdsFetched []int64 | ||
251 | + for _, cooperationContractRelevant := range cooperationContractRelevantModelsFetched { | ||
252 | + cooperationContractRelevantIdsFetched = append(cooperationContractRelevantIdsFetched, cooperationContractRelevant.CooperationContractRelevantId) | ||
253 | + } | ||
254 | + | ||
235 | // 待更新相关人 | 255 | // 待更新相关人 |
236 | var cooperationContractRelevantPeopleToUpdate []*domain.Relevant | 256 | var cooperationContractRelevantPeopleToUpdate []*domain.Relevant |
237 | 257 | ||
238 | // 待添加相关人 | 258 | // 待添加相关人 |
239 | var cooperationContractRelevantPeopleToAdd []*domain.Relevant | 259 | var cooperationContractRelevantPeopleToAdd []*domain.Relevant |
240 | - | ||
241 | for _, relevant := range cooperationContract.RelevantPeople { | 260 | for _, relevant := range cooperationContract.RelevantPeople { |
242 | if relevant.RelevantId != 0 { | 261 | if relevant.RelevantId != 0 { |
243 | cooperationContractRelevantPeopleToUpdate = append(cooperationContractRelevantPeopleToUpdate, relevant) | 262 | cooperationContractRelevantPeopleToUpdate = append(cooperationContractRelevantPeopleToUpdate, relevant) |
@@ -246,49 +265,67 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -246,49 +265,67 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
246 | } | 265 | } |
247 | } | 266 | } |
248 | 267 | ||
249 | - // 待删除相关人,对比待更新的和数据库已有的 | ||
250 | - | ||
251 | - //var cooperationContractRelevantModelsDelete []*models.CooperationContractRelevant // 待删除的相关人 | ||
252 | - //var cooperationContractRelevantModelsCreate []*models.CooperationContractRelevant // 待增加的相关人 | ||
253 | - | ||
254 | - var relevantIdsHave []int64 | ||
255 | - var relevantIdsModify []int64 | ||
256 | - //var relevantIdsUpdate []int64 | ||
257 | - | ||
258 | - // 待更新相关人id数组 | ||
259 | - for _, cooperationContractRelevantModel := range cooperationContractRelevantFetched { | ||
260 | - relevantIdsHave = append(relevantIdsHave, cooperationContractRelevantModel.CooperationContractRelevantId) | 268 | + // 将待添加的相关人领域模型转换为数据模型 |
269 | + var cooperationContractRelevantPeopleToAddModels []*models.CooperationContractRelevant | ||
270 | + for _, relevantDomain := range cooperationContractRelevantPeopleToAdd { | ||
271 | + cooperationContractRelevantPeopleToAddModels = append(cooperationContractRelevantPeopleToAddModels, &models.CooperationContractRelevant{ | ||
272 | + CooperationContractNumber: relevantDomain.CooperationContractNumber, | ||
273 | + UserId: relevantDomain.UserId, | ||
274 | + UserBaseId: relevantDomain.UserBaseId, | ||
275 | + Org: relevantDomain.Org, | ||
276 | + Orgs: relevantDomain.Orgs, | ||
277 | + Department: relevantDomain.Department, | ||
278 | + Role: relevantDomain.Role, | ||
279 | + UserInfo: relevantDomain.UserInfo, | ||
280 | + UserType: relevantDomain.UserType, | ||
281 | + Status: relevantDomain.Status, | ||
282 | + Company: relevantDomain.Company, | ||
283 | + UpdatedAt: time.Time{}, | ||
284 | + DeletedAt: time.Time{}, | ||
285 | + CreatedAt: time.Now(), | ||
286 | + }) | ||
287 | + } | ||
288 | + // 添加相关人 | ||
289 | + if _, err := tx.Model(&cooperationContractRelevantPeopleToAddModels).Insert(); err != nil { | ||
290 | + return nil, err | ||
261 | } | 291 | } |
262 | 292 | ||
263 | - for _, cooperationContractRelevantDomain := range cooperationContract.RelevantPeople { | ||
264 | - relevantIdsModify = append(relevantIdsModify, cooperationContractRelevantDomain.RelevantId) | 293 | + // 待更新或者删除的ids |
294 | + var cooperationContractRelevantPeopleToUpdateOrDeleteIds []int64 | ||
295 | + for _, cooperationContractRelevantPersonToUpdate := range cooperationContractRelevantPeopleToUpdate { | ||
296 | + cooperationContractRelevantPeopleToUpdateOrDeleteIds = append(cooperationContractRelevantPeopleToUpdateOrDeleteIds, cooperationContractRelevantPersonToUpdate.RelevantId) | ||
265 | } | 297 | } |
266 | 298 | ||
267 | - // 待更新的相关人 | ||
268 | - //relevantIdsUpdate := utils.Intersect(relevantIdsHave, relevantIdsModify) | 299 | + // 待更新的相关人id |
300 | + relevantIdsToUpdate := utils.Intersect(cooperationContractRelevantIdsFetched, cooperationContractRelevantPeopleToUpdateOrDeleteIds) | ||
301 | + var relevantModelsToUpdate []*models.CooperationContractRelevant | ||
302 | + for _, id := range relevantIdsToUpdate { | ||
303 | + for _, relevantModel := range cooperationContractRelevantModelsFetched { | ||
304 | + if relevantModel.CooperationContractRelevantId == id { | ||
305 | + relevantModelsToUpdate = append(relevantModelsToUpdate, relevantModel) | ||
306 | + } | ||
307 | + } | ||
308 | + } | ||
309 | + if _, err := tx.Model(&relevantModelsToUpdate).WherePK().Update(); err != nil { | ||
310 | + return nil, err | ||
311 | + } | ||
269 | 312 | ||
270 | - var relevantPeopleModelUpdate []*models.CooperationContractRelevant | ||
271 | - for _, cooperationContractRelevantDomain := range cooperationContract.RelevantPeople { | ||
272 | - relevantPeopleModelUpdate = append(relevantPeopleModelUpdate, &models.CooperationContractRelevant{ | ||
273 | - CooperationContractRelevantId: cooperationContractRelevantDomain.RelevantId, | ||
274 | - CooperationContractNumber: cooperationContractRelevantDomain.CooperationContractNumber, | ||
275 | - UserId: cooperationContractRelevantDomain.UserId, | ||
276 | - UserBaseId: cooperationContractRelevantDomain.UserBaseId, | ||
277 | - Org: cooperationContractRelevantDomain.Org, | ||
278 | - Orgs: cooperationContractRelevantDomain.Orgs, | ||
279 | - Department: cooperationContractRelevantDomain.Department, | ||
280 | - Role: cooperationContractRelevantDomain.Role, | ||
281 | - UserInfo: cooperationContractRelevantDomain.UserInfo, | ||
282 | - UserType: cooperationContractRelevantDomain.UserType, | ||
283 | - Status: cooperationContractRelevantDomain.Status, | ||
284 | - Company: cooperationContractRelevantDomain.Company, | ||
285 | - UpdatedAt: time.Now(), | ||
286 | - DeletedAt: time.Time{}, | ||
287 | - CreatedAt: time.Time{}, | ||
288 | - }) | 313 | + // 待删除的相关人id |
314 | + relevantIdsToDelete := utils.Difference(cooperationContractRelevantIdsFetched, cooperationContractRelevantPeopleToUpdateOrDeleteIds) | ||
315 | + var relevantModelsToDelete []*models.CooperationContractRelevant | ||
316 | + for _, id := range relevantIdsToDelete { | ||
317 | + for _, relevantModel := range cooperationContractRelevantModelsFetched { | ||
318 | + if relevantModel.CooperationContractRelevantId == id { | ||
319 | + relevantModelsToDelete = append(relevantModelsToDelete, relevantModel) | ||
320 | + } | ||
321 | + } | ||
322 | + } | ||
323 | + if _, err := tx.Model(&relevantModelsToDelete).WherePK().Delete(); err != nil { | ||
324 | + return nil, err | ||
289 | } | 325 | } |
290 | 326 | ||
291 | //TODO 更新承接人 | 327 | //TODO 更新承接人 |
328 | + | ||
292 | // 获取承接人列表 | 329 | // 获取承接人列表 |
293 | var cooperationContractUndertakersFetched []*models.CooperationContractUndertaker | 330 | var cooperationContractUndertakersFetched []*models.CooperationContractUndertaker |
294 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakersFetched) | 331 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakersFetched) |
@@ -297,6 +334,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -297,6 +334,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
297 | } | 334 | } |
298 | 335 | ||
299 | //TODO 更新分红激励规则 | 336 | //TODO 更新分红激励规则 |
337 | + | ||
300 | // 获取分红激励规则列表 | 338 | // 获取分红激励规则列表 |
301 | var dividendsIncentivesRulesFetched []*models.DividendsIncentivesRule | 339 | var dividendsIncentivesRulesFetched []*models.DividendsIncentivesRule |
302 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRulesFetched) | 340 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRulesFetched) |
@@ -305,6 +343,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -305,6 +343,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
305 | } | 343 | } |
306 | 344 | ||
307 | //TODO 更新金额激励规则 | 345 | //TODO 更新金额激励规则 |
346 | + | ||
308 | // 获取金额激励规则列表 | 347 | // 获取金额激励规则列表 |
309 | var moneyIncentivesRulesFetched []*models.MoneyIncentivesRule | 348 | var moneyIncentivesRulesFetched []*models.MoneyIncentivesRule |
310 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRulesFetched) | 349 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRulesFetched) |
@@ -28,7 +28,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | @@ -28,7 +28,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | ||
28 | sqlBuildFields := []string{ | 28 | sqlBuildFields := []string{ |
29 | "cooperation_contract_undertaker_id", | 29 | "cooperation_contract_undertaker_id", |
30 | "cooperation_contract_number", | 30 | "cooperation_contract_number", |
31 | - "undertaker", | 31 | + "user_id", |
32 | + "user_base_id", | ||
33 | + "org", | ||
34 | + "orgs", | ||
35 | + "department", | ||
36 | + "role", | ||
37 | + "user_info", | ||
38 | + "user_type", | ||
39 | + "referrer", | ||
40 | + "salesman", | ||
41 | + "status", | ||
42 | + "company", | ||
43 | + "contract_attachment", | ||
32 | "created_at", | 44 | "created_at", |
33 | "updated_at", | 45 | "updated_at", |
34 | "deleted_at", | 46 | "deleted_at", |
@@ -50,7 +62,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | @@ -50,7 +62,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | ||
50 | pg.Scan( | 62 | pg.Scan( |
51 | &cooperationContractUndertaker.CooperationContractUndertakerId, | 63 | &cooperationContractUndertaker.CooperationContractUndertakerId, |
52 | &cooperationContractUndertaker.CooperationContractNumber, | 64 | &cooperationContractUndertaker.CooperationContractNumber, |
53 | - &cooperationContractUndertaker.Undertaker, | 65 | + &cooperationContractUndertaker.Undertaker.UserId, |
66 | + &cooperationContractUndertaker.Undertaker.UserBaseId, | ||
67 | + &cooperationContractUndertaker.Undertaker.Org, | ||
68 | + &cooperationContractUndertaker.Undertaker.Orgs, | ||
69 | + &cooperationContractUndertaker.Undertaker.Department, | ||
70 | + &cooperationContractUndertaker.Undertaker.Role, | ||
71 | + &cooperationContractUndertaker.Undertaker.UserInfo, | ||
72 | + &cooperationContractUndertaker.Undertaker.UserType, | ||
73 | + &cooperationContractUndertaker.Undertaker.Referrer, | ||
74 | + &cooperationContractUndertaker.Undertaker.Salesman, | ||
75 | + &cooperationContractUndertaker.Undertaker.Status, | ||
76 | + &cooperationContractUndertaker.Undertaker.Company, | ||
77 | + &cooperationContractUndertaker.Undertaker.ContractAttachment, | ||
54 | &cooperationContractUndertaker.CreatedAt, | 78 | &cooperationContractUndertaker.CreatedAt, |
55 | &cooperationContractUndertaker.UpdatedAt, | 79 | &cooperationContractUndertaker.UpdatedAt, |
56 | &cooperationContractUndertaker.DeletedAt, | 80 | &cooperationContractUndertaker.DeletedAt, |
@@ -58,7 +82,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | @@ -58,7 +82,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | ||
58 | fmt.Sprintf("INSERT INTO cooperation_contract_undertakers (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 82 | fmt.Sprintf("INSERT INTO cooperation_contract_undertakers (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
59 | cooperationContractUndertaker.CooperationContractUndertakerId, | 83 | cooperationContractUndertaker.CooperationContractUndertakerId, |
60 | cooperationContractUndertaker.CooperationContractNumber, | 84 | cooperationContractUndertaker.CooperationContractNumber, |
61 | - cooperationContractUndertaker.Undertaker, | 85 | + &cooperationContractUndertaker.Undertaker.UserId, |
86 | + &cooperationContractUndertaker.Undertaker.UserBaseId, | ||
87 | + &cooperationContractUndertaker.Undertaker.Org, | ||
88 | + &cooperationContractUndertaker.Undertaker.Orgs, | ||
89 | + &cooperationContractUndertaker.Undertaker.Department, | ||
90 | + &cooperationContractUndertaker.Undertaker.Role, | ||
91 | + &cooperationContractUndertaker.Undertaker.UserInfo, | ||
92 | + &cooperationContractUndertaker.Undertaker.UserType, | ||
93 | + &cooperationContractUndertaker.Undertaker.Referrer, | ||
94 | + &cooperationContractUndertaker.Undertaker.Salesman, | ||
95 | + &cooperationContractUndertaker.Undertaker.Status, | ||
96 | + &cooperationContractUndertaker.Undertaker.Company, | ||
97 | + &cooperationContractUndertaker.Undertaker.ContractAttachment, | ||
62 | cooperationContractUndertaker.CreatedAt, | 98 | cooperationContractUndertaker.CreatedAt, |
63 | cooperationContractUndertaker.UpdatedAt, | 99 | cooperationContractUndertaker.UpdatedAt, |
64 | cooperationContractUndertaker.DeletedAt, | 100 | cooperationContractUndertaker.DeletedAt, |
@@ -70,7 +106,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | @@ -70,7 +106,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | ||
70 | pg.Scan( | 106 | pg.Scan( |
71 | &cooperationContractUndertaker.CooperationContractUndertakerId, | 107 | &cooperationContractUndertaker.CooperationContractUndertakerId, |
72 | &cooperationContractUndertaker.CooperationContractNumber, | 108 | &cooperationContractUndertaker.CooperationContractNumber, |
73 | - &cooperationContractUndertaker.Undertaker, | 109 | + &cooperationContractUndertaker.Undertaker.UserId, |
110 | + &cooperationContractUndertaker.Undertaker.UserBaseId, | ||
111 | + &cooperationContractUndertaker.Undertaker.Org, | ||
112 | + &cooperationContractUndertaker.Undertaker.Orgs, | ||
113 | + &cooperationContractUndertaker.Undertaker.Department, | ||
114 | + &cooperationContractUndertaker.Undertaker.Role, | ||
115 | + &cooperationContractUndertaker.Undertaker.UserInfo, | ||
116 | + &cooperationContractUndertaker.Undertaker.UserType, | ||
117 | + &cooperationContractUndertaker.Undertaker.Referrer, | ||
118 | + &cooperationContractUndertaker.Undertaker.Salesman, | ||
119 | + &cooperationContractUndertaker.Undertaker.Status, | ||
120 | + &cooperationContractUndertaker.Undertaker.Company, | ||
121 | + &cooperationContractUndertaker.Undertaker.ContractAttachment, | ||
74 | &cooperationContractUndertaker.CreatedAt, | 122 | &cooperationContractUndertaker.CreatedAt, |
75 | &cooperationContractUndertaker.UpdatedAt, | 123 | &cooperationContractUndertaker.UpdatedAt, |
76 | &cooperationContractUndertaker.DeletedAt, | 124 | &cooperationContractUndertaker.DeletedAt, |
@@ -78,7 +126,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | @@ -78,7 +126,19 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr | ||
78 | fmt.Sprintf("UPDATE cooperation_contract_undertakers SET %s WHERE cooperation_contract_undertaker_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 126 | fmt.Sprintf("UPDATE cooperation_contract_undertakers SET %s WHERE cooperation_contract_undertaker_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
79 | cooperationContractUndertaker.CooperationContractUndertakerId, | 127 | cooperationContractUndertaker.CooperationContractUndertakerId, |
80 | cooperationContractUndertaker.CooperationContractNumber, | 128 | cooperationContractUndertaker.CooperationContractNumber, |
81 | - cooperationContractUndertaker.Undertaker, | 129 | + cooperationContractUndertaker.Undertaker.UserId, |
130 | + cooperationContractUndertaker.Undertaker.UserBaseId, | ||
131 | + cooperationContractUndertaker.Undertaker.Org, | ||
132 | + cooperationContractUndertaker.Undertaker.Orgs, | ||
133 | + cooperationContractUndertaker.Undertaker.Department, | ||
134 | + cooperationContractUndertaker.Undertaker.Role, | ||
135 | + cooperationContractUndertaker.Undertaker.UserInfo, | ||
136 | + cooperationContractUndertaker.Undertaker.UserType, | ||
137 | + cooperationContractUndertaker.Undertaker.Referrer, | ||
138 | + cooperationContractUndertaker.Undertaker.Salesman, | ||
139 | + cooperationContractUndertaker.Undertaker.Status, | ||
140 | + cooperationContractUndertaker.Undertaker.Company, | ||
141 | + cooperationContractUndertaker.Undertaker.ContractAttachment, | ||
82 | cooperationContractUndertaker.CreatedAt, | 142 | cooperationContractUndertaker.CreatedAt, |
83 | cooperationContractUndertaker.UpdatedAt, | 143 | cooperationContractUndertaker.UpdatedAt, |
84 | cooperationContractUndertaker.DeletedAt, | 144 | cooperationContractUndertaker.DeletedAt, |
@@ -26,7 +26,7 @@ func (repository *MoneyIncentivesRuleRepository) nextIdentify() (int64, error) { | @@ -26,7 +26,7 @@ func (repository *MoneyIncentivesRuleRepository) nextIdentify() (int64, error) { | ||
26 | } | 26 | } |
27 | func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { | 27 | func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { |
28 | sqlBuildFields := []string{ | 28 | sqlBuildFields := []string{ |
29 | - "money_icentives_rule_id", | 29 | + "money_incentives_rule_id", |
30 | "cooperation_contract_number", | 30 | "cooperation_contract_number", |
31 | "money_incentives_amount", | 31 | "money_incentives_amount", |
32 | "money_incentives_stage", | 32 | "money_incentives_stage", |
-
请 注册 或 登录 后发表评论