fix: UDM鉴权用户去除Msisdn字段
This commit is contained in:
@@ -14,12 +14,11 @@ import (
|
||||
// 实例化数据层 RepoUdmAuthUser 结构体
|
||||
var NewRepoUdmAuthUser = &RepoUdmAuthUser{
|
||||
selectSql: `select
|
||||
id, msisdn, imsi, amf, status, ki, algo_index, opc, ne_id
|
||||
id, imsi, amf, status, ki, algo_index, opc, ne_id
|
||||
from u_auth_user`,
|
||||
|
||||
resultMap: map[string]string{
|
||||
"id": "ID",
|
||||
"msisdn": "Msisdn",
|
||||
"imsi": "Imsi",
|
||||
"amf": "Amf",
|
||||
"status": "Status",
|
||||
@@ -58,10 +57,6 @@ func (r *RepoUdmAuthUser) SelectPage(query map[string]any) map[string]any {
|
||||
// 查询条件拼接
|
||||
var conditions []string
|
||||
var params []any
|
||||
if v, ok := query["msisdn"]; ok && v != "" {
|
||||
conditions = append(conditions, "msisdn like concat(concat('%', ?), '%')")
|
||||
params = append(params, v)
|
||||
}
|
||||
if v, ok := query["imsi"]; ok && v != "" {
|
||||
conditions = append(conditions, "imsi like concat(concat('%', ?), '%')")
|
||||
params = append(params, v)
|
||||
@@ -77,18 +72,23 @@ func (r *RepoUdmAuthUser) SelectPage(query map[string]any) map[string]any {
|
||||
whereSql += " where " + strings.Join(conditions, " and ")
|
||||
}
|
||||
|
||||
result := map[string]any{
|
||||
"total": 0,
|
||||
"rows": []model.UdmAuthUser{},
|
||||
}
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
totalSql := "select count(1) as 'total' from u_auth_user"
|
||||
totalRows, err := datasource.RawDB("", totalSql+whereSql, params)
|
||||
if err != nil {
|
||||
log.Errorf("total err => %v", err)
|
||||
return result
|
||||
}
|
||||
total := parse.Number(totalRows[0]["total"])
|
||||
if total == 0 {
|
||||
return map[string]any{
|
||||
"total": total,
|
||||
"rows": nil,
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
result["total"] = total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -120,11 +120,8 @@ func (r *RepoUdmAuthUser) SelectPage(query map[string]any) map[string]any {
|
||||
}
|
||||
|
||||
// 转换实体
|
||||
rows := r.convertResultRows(results)
|
||||
return map[string]any{
|
||||
"total": total,
|
||||
"rows": rows,
|
||||
}
|
||||
result["rows"] = r.convertResultRows(results)
|
||||
return result
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
@@ -89,22 +89,23 @@ func (r *RepoUdmSubUser) SelectPage(query map[string]any) map[string]any {
|
||||
whereSql += " where " + strings.Join(conditions, " and ")
|
||||
}
|
||||
|
||||
result := map[string]any{
|
||||
"total": 0,
|
||||
"rows": []model.UdmAuthUser{},
|
||||
}
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
totalSql := "select count(1) as 'total' from u_sub_user"
|
||||
totalRows, err := datasource.RawDB("", totalSql+whereSql, params)
|
||||
if err != nil {
|
||||
log.Errorf("total err => %v", err)
|
||||
return map[string]any{
|
||||
"total": 0,
|
||||
"rows": nil,
|
||||
}
|
||||
return result
|
||||
}
|
||||
total := parse.Number(totalRows[0]["total"])
|
||||
if total == 0 {
|
||||
return map[string]any{
|
||||
"total": total,
|
||||
"rows": nil,
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
result["total"] = total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -133,14 +134,12 @@ func (r *RepoUdmSubUser) SelectPage(query map[string]any) map[string]any {
|
||||
results, err := datasource.RawDB("", querySql, params)
|
||||
if err != nil {
|
||||
log.Errorf("query err => %v", err)
|
||||
return result
|
||||
}
|
||||
|
||||
// 转换实体
|
||||
rows := r.convertResultRows(results)
|
||||
return map[string]any{
|
||||
"total": total,
|
||||
"rows": rows,
|
||||
}
|
||||
result["rows"] = r.convertResultRows(results)
|
||||
return result
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
Reference in New Issue
Block a user