fix: 主机信息删除时禁止删除网元组
This commit is contained in:
@@ -169,7 +169,7 @@ func (s NeHostController) Remove(c *gin.Context) {
|
||||
ids = append(ids, parse.Number(v))
|
||||
}
|
||||
|
||||
rows, err := s.neHostService.DeleteByIds(ids)
|
||||
rows, err := s.neHostService.DeleteByIds(ids, true)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
|
||||
@@ -137,7 +137,8 @@ func (r NeHost) Update(neHost model.NeHost) int64 {
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除网元主机连接信息
|
||||
func (r NeHost) DeleteByIds(hostIds []int64) (int64, error) {
|
||||
// checkNeHost 是否检查网元主机
|
||||
func (r NeHost) DeleteByIds(hostIds []int64, checkNeHost bool) (int64, error) {
|
||||
// 检查是否存在
|
||||
ids := r.neHostRepository.SelectByIds(hostIds)
|
||||
if len(ids) <= 0 {
|
||||
@@ -145,7 +146,7 @@ func (r NeHost) DeleteByIds(hostIds []int64) (int64, error) {
|
||||
}
|
||||
|
||||
for _, v := range ids {
|
||||
if v.GroupID == "1" {
|
||||
if v.GroupID == "1" && checkNeHost {
|
||||
// 主机信息操作【%s】失败,禁止操作网元
|
||||
return 0, fmt.Errorf("neHost.banNE")
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ func (r NeInfo) DeleteByIds(ids []int64) (int64, error) {
|
||||
for _, hostId := range arr {
|
||||
hostIds = append(hostIds, parse.Number(hostId))
|
||||
}
|
||||
r.neHostService.DeleteByIds(hostIds)
|
||||
r.neHostService.DeleteByIds(hostIds, false)
|
||||
}
|
||||
// 删除License
|
||||
neLicense := NewNeLicense.FindByNeTypeAndNeID(v.NeType, v.NeId)
|
||||
|
||||
Reference in New Issue
Block a user