fix: 参数示例数据的存储规则
This commit is contained in:
@@ -78,8 +78,17 @@ func (r *PtNeConfigDataService) DeleteByIds(paramIds []string) (int64, error) {
|
||||
return 0, fmt.Errorf("delete fail")
|
||||
}
|
||||
|
||||
// SaveAsDefaultByType 保存为默认示例
|
||||
func (r *PtNeConfigDataService) SaveAsDefaultByType(neInfo neModel.NeInfo, stubType, operaUserName string) {
|
||||
// SaveAsDefault 系统网元配置保存为系统示例
|
||||
func (r *PtNeConfigDataService) SaveAsDefault(neType, neId string) {
|
||||
// 查询网元获取IP获取网元状态
|
||||
neInfo := r.neInfoService.SelectNeInfoByNeTypeAndNeID(neType, neId)
|
||||
if neInfo.NeId != neId || neInfo.IP == "" {
|
||||
return
|
||||
}
|
||||
|
||||
stubType := "0"
|
||||
operaUserName := "admin"
|
||||
deptId := "100"
|
||||
confs := r.neConfigService.SelectList(neModel.NeConfig{NeType: neInfo.NeType})
|
||||
for _, v := range confs {
|
||||
// 查询是否存在记录
|
||||
@@ -113,6 +122,7 @@ func (r *PtNeConfigDataService) SaveAsDefaultByType(neInfo neModel.NeInfo, stubT
|
||||
ParamDisplay: v.ParamDisplay,
|
||||
ParamType: v.ParamType,
|
||||
ParamJson: string(paramDataByte),
|
||||
DeptId: deptId,
|
||||
})
|
||||
}
|
||||
// 更新
|
||||
@@ -121,14 +131,24 @@ func (r *PtNeConfigDataService) SaveAsDefaultByType(neInfo neModel.NeInfo, stubT
|
||||
item.UpdateBy = operaUserName
|
||||
item.ParamDisplay = v.ParamDisplay
|
||||
item.ParamJson = string(paramDataByte)
|
||||
item.DeptId = deptId
|
||||
r.Update(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ResetAsDefaultByType 重置为默认示例
|
||||
func (r *PtNeConfigDataService) ResetAsDefaultByType(neType, stubType, operaUserName string) {
|
||||
ptConfs := r.SelectList(model.PtNeConfigData{StubType: "0", NeType: neType})
|
||||
// ResetAsDefault 重置配置示例
|
||||
// stubType:2个人为班级示例 1班级为系统示例
|
||||
func (r *PtNeConfigDataService) ResetAsDefault(operaUserName, stubType, neType, deptId string) {
|
||||
rootStubType := "1"
|
||||
if stubType == "1" {
|
||||
rootStubType = "0"
|
||||
}
|
||||
if stubType == "2" {
|
||||
rootStubType = "1"
|
||||
}
|
||||
ptConfs := r.SelectList(model.PtNeConfigData{StubType: rootStubType, NeType: neType})
|
||||
|
||||
for _, v := range ptConfs {
|
||||
// 查询是否存在记录
|
||||
hasItems := r.SelectList(model.PtNeConfigData{
|
||||
@@ -149,6 +169,7 @@ func (r *PtNeConfigDataService) ResetAsDefaultByType(neType, stubType, operaUser
|
||||
ParamDisplay: v.ParamDisplay,
|
||||
ParamType: v.ParamType,
|
||||
ParamJson: v.ParamJson,
|
||||
DeptId: deptId,
|
||||
})
|
||||
}
|
||||
// 更新
|
||||
@@ -157,6 +178,7 @@ func (r *PtNeConfigDataService) ResetAsDefaultByType(neType, stubType, operaUser
|
||||
item.UpdateBy = operaUserName
|
||||
item.ParamDisplay = v.ParamDisplay
|
||||
item.ParamJson = v.ParamJson
|
||||
item.DeptId = deptId
|
||||
r.Update(item)
|
||||
}
|
||||
}
|
||||
@@ -173,6 +195,7 @@ func (r *PtNeConfigDataService) SelectByStubType(param model.PtNeConfigData) mod
|
||||
if len(list) == 0 && param.StubType != "0" {
|
||||
param.CreateBy = ""
|
||||
param.StubType = "0"
|
||||
param.DeptId = "100"
|
||||
list = r.SelectList(param)
|
||||
}
|
||||
var paraData model.PtNeConfigData
|
||||
@@ -192,7 +215,7 @@ func (r *PtNeConfigDataService) ApplyToNe(paramUser, neType string) error {
|
||||
return fmt.Errorf("NeConfigData Not Found")
|
||||
}
|
||||
|
||||
// 找网元,只有一套就固定001
|
||||
// 找网元,只有一套就固定neId:001
|
||||
neInfo := r.neInfoService.SelectNeInfoByNeTypeAndNeID(neType, "001")
|
||||
if neInfo.NeType != neType || neInfo.ID == "" {
|
||||
return fmt.Errorf("NeInfo Not Found")
|
||||
|
||||
Reference in New Issue
Block a user