diff --git a/src/modules/network_data/repository/alarm.go b/src/modules/network_data/repository/alarm.go index 745662b7..aa21d678 100644 --- a/src/modules/network_data/repository/alarm.go +++ b/src/modules/network_data/repository/alarm.go @@ -1,6 +1,7 @@ package repository import ( + "fmt" "strings" "time" @@ -32,7 +33,7 @@ func (r Alarm) SelectByPage(query model.AlarmQuery) ([]model.Alarm, int64) { tx = tx.Where("pv_flag = ?", query.PvFlag) } if query.AlarmCode != "" { - tx = tx.Where("alarm_code = ?", query.AlarmCode) + tx = tx.Where("alarm_code like ?", fmt.Sprintf("%%%s%%", query.AlarmCode)) } if query.AlarmType != "" { tx = tx.Where("alarm_type in (?)", strings.Split(query.AlarmType, ",")) diff --git a/src/modules/network_data/repository/cdr_event.go b/src/modules/network_data/repository/cdr_event.go index 0123ea0b..d115e3d1 100644 --- a/src/modules/network_data/repository/cdr_event.go +++ b/src/modules/network_data/repository/cdr_event.go @@ -42,10 +42,10 @@ func (r CDREvent) SelectByPage(neType string, query map[string]string) ([]model. switch neType { case "SMSC": if v, ok := query["callerParty"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.callerParty') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.callerParty') like ?", fmt.Sprintf("%%%s%%", v)) } if v, ok := query["calledParty"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.calledParty') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.calledParty') like ?", fmt.Sprintf("%%%s%%", v)) } if v, ok := query["recordType"]; ok && v != "" { recordTypes := strings.Split(v, ",") @@ -60,24 +60,24 @@ func (r CDREvent) SelectByPage(neType string, query map[string]string) ([]model. tx = tx.Where("JSON_EXTRACT(cdr_json, '$.recordType') = ?", v) } if v, ok := query["subscriberID"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.subscriberIdentifier.subscriptionIDData') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.subscriberIdentifier.subscriptionIDData') like ?", fmt.Sprintf("%%%s%%", v)) } if v, ok := query["dnn"]; ok && v != "" { tx = tx.Where("JSON_EXTRACT(cdr_json, '$.pDUSessionChargingInformation.dNNID') = ?", v) } case "SGWC": if v, ok := query["imsi"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.servedIMSI') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.servedIMSI') like ?", fmt.Sprintf("%%%s%%", v)) } if v, ok := query["msisdn"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.servedMSISDN') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.servedMSISDN') like ?", fmt.Sprintf("%%%s%%", v)) } case "IMS": if v, ok := query["callerParty"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.callerParty') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.callerParty') like ?", fmt.Sprintf("%%%s%%", v)) } if v, ok := query["calledParty"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(cdr_json, '$.calledParty') = ?", v) + tx = tx.Where("JSON_EXTRACT(cdr_json, '$.calledParty') like ?", fmt.Sprintf("%%%s%%", v)) } } diff --git a/src/modules/network_data/repository/ue_event.go b/src/modules/network_data/repository/ue_event.go index e026e7eb..c2eb2579 100644 --- a/src/modules/network_data/repository/ue_event.go +++ b/src/modules/network_data/repository/ue_event.go @@ -42,7 +42,7 @@ func (r UEEvent) SelectByPage(neType string, query map[string]string) ([]model.U tx = tx.Where("event_type in ?", eventTypes) } if v, ok := query["imsi"]; ok && v != "" { - tx = tx.Where("JSON_EXTRACT(event_json, '$.imsi') = ?", v) + tx = tx.Where("JSON_EXTRACT(event_json, '$.imsi') like ?", fmt.Sprintf("%%%s%%", v)) } // 查询结果