作者 yangfu

索引优化

@@ -58,6 +58,8 @@ type SearchCooperationProjectQuery struct { @@ -58,6 +58,8 @@ type SearchCooperationProjectQuery struct {
58 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"` 58 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
59 // 按共创项目状态排序 59 // 按共创项目状态排序
60 SortByStatus int32 `cname:"按共创项目状态排序" json:"sortByStatus,omitempty"` 60 SortByStatus int32 `cname:"按共创项目状态排序" json:"sortByStatus,omitempty"`
  61 + // 是否跳过获取共创模式
  62 + IsSkipFetchProjectModel bool `cname:"是否跳过获取共创模式" json:"isSkipFetchProjectModel,omitempty"`
61 } 63 }
62 64
63 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) { 65 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) {
@@ -341,6 +341,14 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -341,6 +341,14 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
341 } else { 341 } else {
342 if count > 0 { 342 if count > 0 {
343 for _, cooperationProjectModel := range cooperationProjectModels { 343 for _, cooperationProjectModel := range cooperationProjectModels {
  344 + if v, ok := queryOptions["isSkipFetchProjectModel"]; ok && v.(bool) {
  345 + if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, &models.CooperationMode{}); err != nil {
  346 + return 0, cooperationProjects, err
  347 + } else {
  348 + cooperationProjects = append(cooperationProjects, cooperationProject)
  349 + }
  350 + continue
  351 + }
344 // 获取共创模式 352 // 获取共创模式
345 var cooperationModeModels []*models.CooperationMode 353 var cooperationModeModels []*models.CooperationMode
346 cooperationModeQuery := tx.Model(&cooperationModeModels) 354 cooperationModeQuery := tx.Model(&cooperationModeModels)