| | |
| | | var document_number_list []string |
| | | err := db.GetDB().Raw(` |
| | | SELECT |
| | | p.id, |
| | | s.document_number, |
| | | -- s.community_id, |
| | | -- s.org_id, |
| | | -- p.person_name, |
| | | -- p.id_card, |
| | | s.last_appearance_time, |
| | | -- s.last_direction, |
| | | -- s.last_location |
| | | s.last_appearance_time |
| | | FROM |
| | | snapshot_count_summary AS s |
| | | JOIN person AS p ON p.id = s.document_number |
| | | WHERE |
| | | p.id_card != "" |
| | | AND (p.community_id IN ? |
| | | OR p.org_id IN ?) |
| | | AND p.status IN ? |
| | | AND (s.community_id IN ? OR s.org_id IN ?) |
| | | AND s.status IN ? |
| | | `, m.AreaIds, m.OrgIds, m.PersonIdentity).Scan(&baseFilter).Error |
| | | if err != nil { |
| | | logger.Warnf(err.Error()) |
| | | } |
| | | |
| | | if len(baseFilter) == 0 { |
| | | return fmt.Errorf("no results found that match the age condition %s - %s ", m.AreaIds, m.OrgIds) |
| | | return fmt.Errorf("no results found that match the age condition %s - %s - %s ", m.AreaIds, m.OrgIds, m.PersonIdentity) |
| | | } |
| | | |
| | | logger.Debugf("task %s match age result %d", m.Task.Name, len(baseFilter)) |