feat: 网元类型缓存ByNeTypeAndNeID

This commit is contained in:
TsMask
2024-02-05 14:39:30 +08:00
parent 5da8a8b51d
commit df9d880a7f
5 changed files with 84 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ import (
"ems.agt/lib/services"
"ems.agt/restagent/config"
tokenConst "ems.agt/src/framework/constants/token"
neService "ems.agt/src/modules/network_element/service"
"github.com/go-resty/resty/v2"
"github.com/gorilla/mux"
@@ -158,6 +159,9 @@ func PostNeInfo(w http.ResponseWriter, r *http.Request) {
return
}
// 刷新缓存不存在结构体网元Id空字符串
neService.NewNeInfoImpl.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId)
mapRow := make(map[string]interface{})
row := map[string]interface{}{"affectedRows": affected}
mapRow["data"] = row
@@ -205,6 +209,10 @@ func PostNeInfo(w http.ResponseWriter, r *http.Request) {
} else if affected <= 0 {
log.Infof("Not record affected to insert ne_info")
}
// 刷新缓存不存在结构体网元Id空字符串
neService.NewNeInfoImpl.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId)
services.ResponseStatusOK204NoContent(w)
return
default:
@@ -261,6 +269,9 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
return
}
// 刷新缓存不存在结构体网元Id空字符串
neService.NewNeInfoImpl.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId)
mapRow := make(map[string]interface{})
row := map[string]interface{}{"affectedRows": affected}
mapRow["data"] = row
@@ -309,6 +320,10 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
} else if affected <= 0 {
log.Infof("Not record affected to insert ne_info")
}
// 刷新缓存不存在结构体网元Id空字符串
neService.NewNeInfoImpl.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId)
services.ResponseStatusOK204NoContent(w)
return
default:
@@ -390,6 +405,9 @@ func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
return
}
// 刷新缓存不存在结构体网元Id空字符串
neService.NewNeInfoImpl.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId)
mapRow := make(map[string]interface{})
row := map[string]interface{}{"affectedRows": affected}
mapRow["data"] = row