Merge branch 'feature_order_number' into test
正在显示
2 个修改的文件
包含
5 行增加
和
0 行删除
@@ -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) { |
@@ -335,6 +335,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int | @@ -335,6 +335,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int | ||
335 | if offsetLimitFlag { | 335 | if offsetLimitFlag { |
336 | query.SetOffsetAndLimit(20) | 336 | query.SetOffsetAndLimit(20) |
337 | } | 337 | } |
338 | + if v, ok := queryOptions["sortByStatus"]; ok && v.(int32) > 0 { | ||
339 | + query.SetOrderDirect("status", "ASC") | ||
340 | + } | ||
338 | query.SetOrderDirect("cooperation_project_id", "DESC") | 341 | query.SetOrderDirect("cooperation_project_id", "DESC") |
339 | if count, err := query.SelectAndCount(); err != nil { | 342 | if count, err := query.SelectAndCount(); err != nil { |
340 | return 0, cooperationProjects, err | 343 | return 0, cooperationProjects, err |
-
请 注册 或 登录 后发表评论