fix: UDM鉴权用户去除Msisdn字段

This commit is contained in:
TsMask
2023-09-19 15:30:48 +08:00
parent ab1c93fee2
commit 3308b0e9df
4 changed files with 58 additions and 60 deletions

View File

@@ -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 根据实体查询