作者 yangfu

共创项目搜索修改

@@ -56,6 +56,8 @@ type SearchCooperationProjectQuery struct { @@ -56,6 +56,8 @@ type SearchCooperationProjectQuery struct {
56 SearchCooperationProjectExtQueriesFlag int `cname:"额外的查询条件标识" json:"searchCooperationProjectExtQueriesFlag"` 56 SearchCooperationProjectExtQueriesFlag int `cname:"额外的查询条件标识" json:"searchCooperationProjectExtQueriesFlag"`
57 // 额外的查询条件 57 // 额外的查询条件
58 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"` 58 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
  59 + // 按共创项目状态排序
  60 + SortByStatus int32 `cname:"按共创项目状态排序" json:"sortByStatus,omitempty"`
59 } 61 }
60 62
61 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) { 63 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) {
@@ -332,6 +332,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -332,6 +332,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
332 if offsetLimitFlag { 332 if offsetLimitFlag {
333 query.SetOffsetAndLimit(20) 333 query.SetOffsetAndLimit(20)
334 } 334 }
  335 + if v, ok := queryOptions["sortByStatus"]; ok && v.(int32) > 0 {
  336 + query.SetOrderDirect("status", "ASC")
  337 + }
335 query.SetOrderDirect("cooperation_project_id", "DESC") 338 query.SetOrderDirect("cooperation_project_id", "DESC")
336 if count, err := query.SelectAndCount(); err != nil { 339 if count, err := query.SelectAndCount(); err != nil {
337 return 0, cooperationProjects, err 340 return 0, cooperationProjects, err