|
@@ -269,17 +269,19 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int |
|
@@ -269,17 +269,19 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int |
269
|
if count, err := query.SelectAndCount(); err != nil {
|
269
|
if count, err := query.SelectAndCount(); err != nil {
|
270
|
return 0, cooperationProjects, err
|
270
|
return 0, cooperationProjects, err
|
271
|
} else {
|
271
|
} else {
|
272
|
- for _, cooperationProjectModel := range cooperationProjectModels {
|
|
|
273
|
- // 获取共创模式
|
|
|
274
|
- cooperationModeModel := new(models.CooperationMode)
|
|
|
275
|
- cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
276
|
- if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
|
|
|
277
|
- return 0, nil, err
|
|
|
278
|
- }
|
|
|
279
|
- if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil {
|
|
|
280
|
- return 0, cooperationProjects, err
|
|
|
281
|
- } else {
|
|
|
282
|
- cooperationProjects = append(cooperationProjects, cooperationProject)
|
272
|
+ if count > 0 {
|
|
|
273
|
+ for _, cooperationProjectModel := range cooperationProjectModels {
|
|
|
274
|
+ // 获取共创模式
|
|
|
275
|
+ cooperationModeModel := new(models.CooperationMode)
|
|
|
276
|
+ cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
277
|
+ if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
|
|
|
278
|
+ return 0, nil, err
|
|
|
279
|
+ }
|
|
|
280
|
+ if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil {
|
|
|
281
|
+ return 0, cooperationProjects, err
|
|
|
282
|
+ } else {
|
|
|
283
|
+ cooperationProjects = append(cooperationProjects, cooperationProject)
|
|
|
284
|
+ }
|
283
|
}
|
285
|
}
|
284
|
}
|
286
|
}
|
285
|
return int64(count), cooperationProjects, nil
|
287
|
return int64(count), cooperationProjects, nil
|