|
@@ -276,33 +276,38 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int |
|
@@ -276,33 +276,38 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int |
276
|
return q, nil
|
276
|
return q, nil
|
277
|
})
|
277
|
})
|
278
|
}
|
278
|
}
|
279
|
- if searchCooperationProjectExtQueries, ok := queryOptions["searchCooperationProjectExtQueries"]; ok && len(searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery)) > 0 {
|
|
|
280
|
- query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
281
|
- for _, searchCooperationProjectExtQuery := range searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery) {
|
|
|
282
|
- query.WhereOrGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
283
|
- if searchCooperationProjectExtQuery.ExtCompanyId != 0 {
|
|
|
284
|
- q.Where("company->>'companyId' = '?'", searchCooperationProjectExtQuery.ExtCompanyId)
|
|
|
285
|
- }
|
|
|
286
|
- if searchCooperationProjectExtQuery.ExtOrgId != 0 {
|
|
|
287
|
- q.Where("org->>'orgId' = '?'", searchCooperationProjectExtQuery.ExtOrgId)
|
|
|
288
|
- }
|
|
|
289
|
- if len(searchCooperationProjectExtQuery.ExtOrgIds) > 0 {
|
|
|
290
|
- newOrgIds := utils.SliceItoa(searchCooperationProjectExtQuery.ExtOrgIds)
|
|
|
291
|
- q.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
|
|
|
292
|
- }
|
|
|
293
|
- if len(searchCooperationProjectExtQuery.ExtCooperationProjectUndertakerTypes) > 0 {
|
|
|
294
|
- q.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
295
|
- for _, cooperationProjectUndertakerType := range searchCooperationProjectExtQuery.ExtCooperationProjectUndertakerTypes {
|
|
|
296
|
- q.WhereOr(`cooperation_project.cooperation_project_undertaker_types @> '{?}'`, cooperationProjectUndertakerType)
|
|
|
297
|
- }
|
|
|
298
|
- return q, nil
|
|
|
299
|
- })
|
|
|
300
|
- }
|
|
|
301
|
- return q, nil
|
|
|
302
|
- })
|
|
|
303
|
- }
|
|
|
304
|
- return q, nil
|
|
|
305
|
- })
|
279
|
+ if searchCooperationProjectExtQueriesFlag, ok := queryOptions["searchCooperationProjectExtQueriesFlag"]; ok && searchCooperationProjectExtQueriesFlag.(int) != 0 {
|
|
|
280
|
+ if searchCooperationProjectExtQueries, ok := queryOptions["searchCooperationProjectExtQueries"]; ok && len(searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery)) > 0 {
|
|
|
281
|
+ query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
282
|
+ for _, searchCooperationProjectExtQuery := range searchCooperationProjectExtQueries.([]*query2.SearchCooperationProjectExtQuery) {
|
|
|
283
|
+ query.WhereOrGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
284
|
+ if searchCooperationProjectExtQuery.ExtCompanyId != 0 {
|
|
|
285
|
+ q.Where("company->>'companyId' = '?'", searchCooperationProjectExtQuery.ExtCompanyId)
|
|
|
286
|
+ }
|
|
|
287
|
+ if searchCooperationProjectExtQuery.ExtOrgId != 0 {
|
|
|
288
|
+ q.Where("org->>'orgId' = '?'", searchCooperationProjectExtQuery.ExtOrgId)
|
|
|
289
|
+ }
|
|
|
290
|
+ if len(searchCooperationProjectExtQuery.ExtOrgIds) > 0 {
|
|
|
291
|
+ newOrgIds := utils.SliceItoa(searchCooperationProjectExtQuery.ExtOrgIds)
|
|
|
292
|
+ q.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
|
|
|
293
|
+ }
|
|
|
294
|
+ if len(searchCooperationProjectExtQuery.ExtCooperationProjectUndertakerTypes) > 0 {
|
|
|
295
|
+ q.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
296
|
+ for _, cooperationProjectUndertakerType := range searchCooperationProjectExtQuery.ExtCooperationProjectUndertakerTypes {
|
|
|
297
|
+ q.WhereOr(`cooperation_project.cooperation_project_undertaker_types @> '{?}'`, cooperationProjectUndertakerType)
|
|
|
298
|
+ }
|
|
|
299
|
+ return q, nil
|
|
|
300
|
+ })
|
|
|
301
|
+ }
|
|
|
302
|
+ return q, nil
|
|
|
303
|
+ })
|
|
|
304
|
+ }
|
|
|
305
|
+ query.WhereOr(`cooperation_project.cooperation_project_undertaker_types @> '{?}'`, 3) //公开
|
|
|
306
|
+ return q, nil
|
|
|
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))
|