fix: 网元参数配置数据信息保存原始数据data:[]
This commit is contained in:
@@ -17,7 +17,7 @@ type PtNeConfigData struct {
|
||||
|
||||
// ====== 非数据库字段属性 ======
|
||||
|
||||
ParamData []map[string]any `json:"paramData,omitempty" binding:"required" gorm:"-"` // 与ParamJson配合转换
|
||||
ParamData map[string]any `json:"paramData,omitempty" binding:"required" gorm:"-"` // 与ParamJson配合转换
|
||||
}
|
||||
|
||||
// TableName 表名称
|
||||
|
||||
@@ -79,7 +79,6 @@ func (r *PtNeConfigDataService) DeleteByIds(paramIds []string) (int64, error) {
|
||||
// SaveAsDefaultByType 保存为默认示例
|
||||
func (r *PtNeConfigDataService) SaveAsDefaultByType(neInfo neModel.NeInfo, stubType, operUserName string) {
|
||||
confs := r.neConfigService.SelectList(neModel.NeConfig{NeType: neInfo.NeType})
|
||||
|
||||
for _, v := range confs {
|
||||
// 查询是否存在记录
|
||||
hasItems := r.SelectList(model.PtNeConfigData{
|
||||
@@ -94,11 +93,10 @@ func (r *PtNeConfigDataService) SaveAsDefaultByType(neInfo neModel.NeInfo, stubT
|
||||
continue
|
||||
}
|
||||
// 将json数据转字符串存储 data:[{},{}]
|
||||
dataArr, ok := resData["data"]
|
||||
if !ok {
|
||||
if _, ok := resData["data"]; !ok {
|
||||
continue
|
||||
}
|
||||
paramDataByte, err := json.Marshal(dataArr)
|
||||
paramDataByte, err := json.Marshal(resData)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -142,7 +140,7 @@ func (r *PtNeConfigDataService) SelectByStubType(param model.PtNeConfigData) mod
|
||||
if len(list) > 0 {
|
||||
paraData = list[0]
|
||||
if err := json.Unmarshal([]byte(paraData.ParamJson), ¶Data.ParamData); err != nil {
|
||||
paraData.ParamData = []map[string]any{}
|
||||
paraData.ParamData = map[string]any{}
|
||||
}
|
||||
}
|
||||
return paraData
|
||||
|
||||
Reference in New Issue
Block a user