add: export file contain tenant name

This commit is contained in:
2024-10-16 19:27:14 +08:00
parent 984332caac
commit e0fd3004e9
7 changed files with 50 additions and 40 deletions

View File

@@ -100,6 +100,9 @@ func (s *AMFController) UEExport(c *gin.Context) {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
// for multi-tenancy
querys.UserName = ctx.LoginUserToUserName(c)
// 限制导出数据集
if querys.PageSize > 10000 {
querys.PageSize = 10000
@@ -121,6 +124,7 @@ func (s *AMFController) UEExport(c *gin.Context) {
"C1": "Event Type",
"D1": "Result",
"E1": "Time",
"F1": "Tenant Name",
}
// 读取字典数据 UE 事件类型
dictUEEventType := sysService.NewSysDictDataImpl.SelectDictDataByType("ue_event_type")
@@ -182,7 +186,7 @@ func (s *AMFController) UEExport(c *gin.Context) {
timeStr = v.(string)
}
if v, ok := eventJSON["status"]; ok && v != nil {
eventResult = v.(string)
eventResult = fmt.Sprint(v)
for _, v := range dictUEEventCmState {
if eventResult == v.DictValue {
eventResult = i18n.TKey(language, v.DictLabel)
@@ -191,6 +195,8 @@ func (s *AMFController) UEExport(c *gin.Context) {
}
}
}
// for multi-tenancy, get tenant name
tenantName := row.TenantName
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
@@ -198,6 +204,7 @@ func (s *AMFController) UEExport(c *gin.Context) {
"C" + idx: eventType,
"D" + idx: eventResult,
"E" + idx: timeStr,
"F" + idx: tenantName,
})
}