作者 yangfu

共创项目搜索修改

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