...
|
...
|
@@ -269,17 +269,19 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int |
|
|
if count, err := query.SelectAndCount(); err != nil {
|
|
|
return 0, cooperationProjects, err
|
|
|
} else {
|
|
|
for _, cooperationProjectModel := range cooperationProjectModels {
|
|
|
// 获取共创模式
|
|
|
cooperationModeModel := new(models.CooperationMode)
|
|
|
cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
|
|
|
return 0, nil, err
|
|
|
}
|
|
|
if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil {
|
|
|
return 0, cooperationProjects, err
|
|
|
} else {
|
|
|
cooperationProjects = append(cooperationProjects, cooperationProject)
|
|
|
if count > 0 {
|
|
|
for _, cooperationProjectModel := range cooperationProjectModels {
|
|
|
// 获取共创模式
|
|
|
cooperationModeModel := new(models.CooperationMode)
|
|
|
cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
|
|
|
return 0, nil, err
|
|
|
}
|
|
|
if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil {
|
|
|
return 0, cooperationProjects, err
|
|
|
} else {
|
|
|
cooperationProjects = append(cooperationProjects, cooperationProject)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return int64(count), cooperationProjects, nil
|
...
|
...
|
|