fix: ims CDR issue with recordType

This commit is contained in:
2024-07-23 17:38:30 +08:00
parent d26aa635b9
commit c402d106f1

View File

@@ -93,11 +93,14 @@ func (r *CDREventIMSImpl) SelectPage(querys model.CDREventIMSQuery) map[string]a
} }
if querys.RecordType != "" { if querys.RecordType != "" {
recordTypes := strings.Split(querys.RecordType, ",") recordTypes := strings.Split(querys.RecordType, ",")
placeholder := repo.KeyPlaceholderByQuery(len(recordTypes)) // placeholder := repo.KeyPlaceholderByQuery(len(recordTypes))
conditions = append(conditions, fmt.Sprintf("JSON_EXTRACT(cdr_json, '$.recordType') in (%s)", placeholder)) // conditions = append(conditions, fmt.Sprintf("JSON_EXTRACT(cdr_json, '$.recordType') in (%s)", placeholder))
var querys []string
for _, recordType := range recordTypes { for _, recordType := range recordTypes {
params = append(params, recordType) querys = append(querys, fmt.Sprintf("JSON_EXTRACT(cdr_json, '$.recordType') = '%s'", recordType))
//params = append(params, recordType)
} }
conditions = append(conditions, "("+strings.Join(querys, " OR ")+")")
} }
// for multi-tenancy solution // for multi-tenancy solution