作者 陈志颖

feat:共创申请接口调整

@@ -13,10 +13,6 @@ type ListCooperationApplicationQuery struct { @@ -13,10 +13,6 @@ type ListCooperationApplicationQuery struct {
13 PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 13 PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"`
14 // 页面大小 14 // 页面大小
15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
16 - // 查询偏离量  
17 - Offset int `cname:"查询偏离量" json:"offset" valid:"Required"`  
18 - // 查询限制  
19 - Limit int `cname:"查询限制" json:"limit" valid:"Required"`  
20 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
21 CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 17 CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"`
22 // 组织机构ID 18 // 组织机构ID
@@ -9,8 +9,10 @@ import ( @@ -9,8 +9,10 @@ import (
9 ) 9 )
10 10
11 type SearchCooperationApplicationQuery struct { 11 type SearchCooperationApplicationQuery struct {
  12 + // 共创项目编号
  13 + CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber,omitempty"`
12 // 共创项目名称 14 // 共创项目名称
13 - CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"` 15 + CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName,omitempty"`
14 // 申请人姓名 16 // 申请人姓名
15 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"` 17 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"`
16 // 共创申请审核状态,1待审核,2已同意,3已拒绝 18 // 共创申请审核状态,1待审核,2已同意,3已拒绝
@@ -24,6 +24,7 @@ func (repository *CooperationApplicationRepository) nextIdentify() (int64, error @@ -24,6 +24,7 @@ func (repository *CooperationApplicationRepository) nextIdentify() (int64, error
24 id, err := IdWorker.NextId() 24 id, err := IdWorker.NextId()
25 return id, err 25 return id, err
26 } 26 }
  27 +
27 func (repository *CooperationApplicationRepository) Save(cooperationApplication *domain.CooperationApplication) (*domain.CooperationApplication, error) { 28 func (repository *CooperationApplicationRepository) Save(cooperationApplication *domain.CooperationApplication) (*domain.CooperationApplication, error) {
28 sqlBuildFields := []string{ 29 sqlBuildFields := []string{
29 "cooperation_application_id", 30 "cooperation_application_id",
@@ -67,7 +68,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication @@ -67,7 +68,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication
67 &cooperationApplication.CooperationApplicationVerifyDescription, 68 &cooperationApplication.CooperationApplicationVerifyDescription,
68 &cooperationApplication.CooperationApplicationVerifyTime, 69 &cooperationApplication.CooperationApplicationVerifyTime,
69 &cooperationApplication.CooperationApplyTime, 70 &cooperationApplication.CooperationApplyTime,
70 - &cooperationApplication.CooperationProject, 71 + &cooperationApplication.CooperationProject.CooperationProjectNumber,
71 &cooperationApplication.Org, 72 &cooperationApplication.Org,
72 &cooperationApplication.IsCanceled, 73 &cooperationApplication.IsCanceled,
73 &cooperationApplication.Company, 74 &cooperationApplication.Company,
@@ -85,12 +86,12 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication @@ -85,12 +86,12 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication
85 cooperationApplication.CooperationApplicationVerifyDescription, 86 cooperationApplication.CooperationApplicationVerifyDescription,
86 cooperationApplication.CooperationApplicationVerifyTime, 87 cooperationApplication.CooperationApplicationVerifyTime,
87 cooperationApplication.CooperationApplyTime, 88 cooperationApplication.CooperationApplyTime,
88 - cooperationApplication.CooperationProject, 89 + cooperationApplication.CooperationProject.CooperationProjectNumber,
89 cooperationApplication.Org, 90 cooperationApplication.Org,
90 cooperationApplication.IsCanceled, 91 cooperationApplication.IsCanceled,
91 cooperationApplication.Company, 92 cooperationApplication.Company,
92 cooperationApplication.CreatedAt, 93 cooperationApplication.CreatedAt,
93 - cooperationApplication.DeletedAt, 94 + nil,
94 cooperationApplication.UpdatedAt, 95 cooperationApplication.UpdatedAt,
95 ); err != nil { 96 ); err != nil {
96 return cooperationApplication, err 97 return cooperationApplication, err
@@ -107,7 +108,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication @@ -107,7 +108,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication
107 &cooperationApplication.CooperationApplicationVerifyDescription, 108 &cooperationApplication.CooperationApplicationVerifyDescription,
108 &cooperationApplication.CooperationApplicationVerifyTime, 109 &cooperationApplication.CooperationApplicationVerifyTime,
109 &cooperationApplication.CooperationApplyTime, 110 &cooperationApplication.CooperationApplyTime,
110 - &cooperationApplication.CooperationProject, 111 + &cooperationApplication.CooperationProject.CooperationProjectNumber,
111 &cooperationApplication.Org, 112 &cooperationApplication.Org,
112 &cooperationApplication.IsCanceled, 113 &cooperationApplication.IsCanceled,
113 &cooperationApplication.Company, 114 &cooperationApplication.Company,
@@ -125,12 +126,12 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication @@ -125,12 +126,12 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication
125 cooperationApplication.CooperationApplicationVerifyDescription, 126 cooperationApplication.CooperationApplicationVerifyDescription,
126 cooperationApplication.CooperationApplicationVerifyTime, 127 cooperationApplication.CooperationApplicationVerifyTime,
127 cooperationApplication.CooperationApplyTime, 128 cooperationApplication.CooperationApplyTime,
128 - cooperationApplication.CooperationProject, 129 + cooperationApplication.CooperationProject.CooperationProjectNumber,
129 cooperationApplication.Org, 130 cooperationApplication.Org,
130 cooperationApplication.IsCanceled, 131 cooperationApplication.IsCanceled,
131 cooperationApplication.Company, 132 cooperationApplication.Company,
132 cooperationApplication.CreatedAt, 133 cooperationApplication.CreatedAt,
133 - cooperationApplication.DeletedAt, 134 + nil,
134 cooperationApplication.UpdatedAt, 135 cooperationApplication.UpdatedAt,
135 cooperationApplication.Identify(), 136 cooperationApplication.Identify(),
136 ); err != nil { 137 ); err != nil {
@@ -139,6 +140,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication @@ -139,6 +140,7 @@ func (repository *CooperationApplicationRepository) Save(cooperationApplication
139 } 140 }
140 return cooperationApplication, nil 141 return cooperationApplication, nil
141 } 142 }
  143 +
142 func (repository *CooperationApplicationRepository) Remove(cooperationApplication *domain.CooperationApplication) (*domain.CooperationApplication, error) { 144 func (repository *CooperationApplicationRepository) Remove(cooperationApplication *domain.CooperationApplication) (*domain.CooperationApplication, error) {
143 tx := repository.transactionContext.PgTx 145 tx := repository.transactionContext.PgTx
144 cooperationApplicationModel := new(models.CooperationApplication) 146 cooperationApplicationModel := new(models.CooperationApplication)
@@ -148,6 +150,7 @@ func (repository *CooperationApplicationRepository) Remove(cooperationApplicatio @@ -148,6 +150,7 @@ func (repository *CooperationApplicationRepository) Remove(cooperationApplicatio
148 } 150 }
149 return cooperationApplication, nil 151 return cooperationApplication, nil
150 } 152 }
  153 +
151 func (repository *CooperationApplicationRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationApplication, error) { 154 func (repository *CooperationApplicationRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationApplication, error) {
152 tx := repository.transactionContext.PgTx 155 tx := repository.transactionContext.PgTx
153 cooperationApplicationModel := new(models.CooperationApplication) 156 cooperationApplicationModel := new(models.CooperationApplication)
@@ -172,6 +175,7 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str @@ -172,6 +175,7 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str
172 return transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel) 175 return transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel)
173 } 176 }
174 } 177 }
  178 +
175 func (repository *CooperationApplicationRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationApplication, error) { 179 func (repository *CooperationApplicationRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationApplication, error) {
176 tx := repository.transactionContext.PgTx 180 tx := repository.transactionContext.PgTx
177 var cooperationApplicationModels []*models.CooperationApplication 181 var cooperationApplicationModels []*models.CooperationApplication
@@ -198,6 +202,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -198,6 +202,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
198 return int64(count), cooperationApplications, nil 202 return int64(count), cooperationApplications, nil
199 } 203 }
200 } 204 }
  205 +
201 func NewCooperationApplicationRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationApplicationRepository, error) { 206 func NewCooperationApplicationRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationApplicationRepository, error) {
202 if transactionContext == nil { 207 if transactionContext == nil {
203 return nil, fmt.Errorf("transactionContext参数不能为nil") 208 return nil, fmt.Errorf("transactionContext参数不能为nil")