作者 yangfu

共创项目修改

@@ -52,6 +52,8 @@ type SearchCooperationProjectQuery struct { @@ -52,6 +52,8 @@ type SearchCooperationProjectQuery struct {
52 UserId int64 `cname:"用户ID" json:"userId"` 52 UserId int64 `cname:"用户ID" json:"userId"`
53 // 用户基础数据id 53 // 用户基础数据id
54 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 54 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
  55 + // 额外的查询条件 0:不需要额外查询 1:额外查询
  56 + SearchCooperationProjectExtQueriesFlag int `cname:"额外的查询条件标识" json:"searchCooperationProjectExtQueriesFlag"`
55 // 额外的查询条件 57 // 额外的查询条件
56 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"` 58 SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
57 } 59 }
@@ -276,6 +276,7 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -276,6 +276,7 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
276 return q, nil 276 return q, nil
277 }) 277 })
278 } 278 }
  279 + if searchCooperationProjectExtQueriesFlag, ok := queryOptions["searchCooperationProjectExtQueriesFlag"]; ok && searchCooperationProjectExtQueriesFlag.(int) != 0 {
279 if searchCooperationProjectExtQueries, ok := queryOptions["searchCooperationProjectExtQueries"]; ok && len(searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery)) > 0 { 280 if searchCooperationProjectExtQueries, ok := queryOptions["searchCooperationProjectExtQueries"]; ok && len(searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery)) > 0 {
280 query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { 281 query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
281 for _, searchCooperationProjectExtQuery := range searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery) { 282 for _, searchCooperationProjectExtQuery := range searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery) {
@@ -301,8 +302,12 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -301,8 +302,12 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
301 return q, nil 302 return q, nil
302 }) 303 })
303 } 304 }
  305 + query.WhereOr(`cooperation_project.cooperation_project_undertaker_types @> '{?}'`, 3) //公开
304 return q, nil 306 return q, nil
305 }) 307 })
  308 + } else {
  309 + query.Where(`cooperation_project.cooperation_project_undertaker_types @> '{?}'`, 3) //公开
  310 + }
306 } 311 }
307 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" { 312 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" {
308 query.Where("department->>'departmentName' like ? ", fmt.Sprintf("%%%s%%", departmentName)) 313 query.Where("department->>'departmentName' like ? ", fmt.Sprintf("%%%s%%", departmentName))