feat: UE/CDR查询条件imsi支持模糊匹配
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ func (r Alarm) SelectByPage(query model.AlarmQuery) ([]model.Alarm, int64) {
|
|||||||
tx = tx.Where("pv_flag = ?", query.PvFlag)
|
tx = tx.Where("pv_flag = ?", query.PvFlag)
|
||||||
}
|
}
|
||||||
if query.AlarmCode != "" {
|
if query.AlarmCode != "" {
|
||||||
tx = tx.Where("alarm_code = ?", query.AlarmCode)
|
tx = tx.Where("alarm_code like ?", fmt.Sprintf("%%%s%%", query.AlarmCode))
|
||||||
}
|
}
|
||||||
if query.AlarmType != "" {
|
if query.AlarmType != "" {
|
||||||
tx = tx.Where("alarm_type in (?)", strings.Split(query.AlarmType, ","))
|
tx = tx.Where("alarm_type in (?)", strings.Split(query.AlarmType, ","))
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ func (r CDREvent) SelectByPage(neType string, query map[string]string) ([]model.
|
|||||||
switch neType {
|
switch neType {
|
||||||
case "SMSC":
|
case "SMSC":
|
||||||
if v, ok := query["callerParty"]; ok && v != "" {
|
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 != "" {
|
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 != "" {
|
if v, ok := query["recordType"]; ok && v != "" {
|
||||||
recordTypes := strings.Split(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)
|
tx = tx.Where("JSON_EXTRACT(cdr_json, '$.recordType') = ?", v)
|
||||||
}
|
}
|
||||||
if v, ok := query["subscriberID"]; ok && 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 != "" {
|
if v, ok := query["dnn"]; ok && v != "" {
|
||||||
tx = tx.Where("JSON_EXTRACT(cdr_json, '$.pDUSessionChargingInformation.dNNID') = ?", v)
|
tx = tx.Where("JSON_EXTRACT(cdr_json, '$.pDUSessionChargingInformation.dNNID') = ?", v)
|
||||||
}
|
}
|
||||||
case "SGWC":
|
case "SGWC":
|
||||||
if v, ok := query["imsi"]; ok && v != "" {
|
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 != "" {
|
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":
|
case "IMS":
|
||||||
if v, ok := query["callerParty"]; ok && v != "" {
|
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 != "" {
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func (r UEEvent) SelectByPage(neType string, query map[string]string) ([]model.U
|
|||||||
tx = tx.Where("event_type in ?", eventTypes)
|
tx = tx.Where("event_type in ?", eventTypes)
|
||||||
}
|
}
|
||||||
if v, ok := query["imsi"]; ok && v != "" {
|
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))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询结果
|
// 查询结果
|
||||||
|
|||||||
Reference in New Issue
Block a user