zhaoqingang
2025-02-19 fca319958029fa924308e50cb61202d7d6ff5008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package models
 
type PersonInfo struct {
    DocumentNumber     string `json:"document_number"`
    CommunityId        string `json:"community_id"`
    OrgId              string `json:"org_id"`
    PersonName         string `json:"person_name"`
    IdCard             string `json:"id_card"`
    FrequentAddress    string `json:"frequent_address"`
    LastAppearanceTime int64  `json:"last_appearance_time"`
    LastDirection      string `json:"last_direction"`
    LastLocation       string `json:"last_location"`
}
 
func GetDomainFilters(orgIds, areaIds []interface{}) (filters []map[string]interface{}) {
    filters = make([]map[string]interface{}, 0)
    // 数据权限过滤
    if len(orgIds) > 0 && len(areaIds) > 0 {
        var authParams = map[string]interface{}{
            "bool": map[string]interface{}{
                "should": []interface{}{
                    map[string]interface{}{
                        "terms": map[string]interface{}{
                            "orgId": orgIds,
                        }},
                    map[string]interface{}{
                        "terms": map[string]interface{}{
                            "communityId": areaIds,
                        }},
                },
            },
        }
        filters = append(filters, authParams)
 
    } else if len(orgIds) > 0 {
        filters = append(filters, map[string]interface{}{
            "terms": map[string]interface{}{
                "orgId": orgIds,
            },
        })
    } else if len(areaIds) > 0 {
        filters = append(filters, map[string]interface{}{
            "terms": map[string]interface{}{
                "communityId": areaIds,
            },
        })
    }
    return filters
}