diff --git a/core/app/dto/command.go b/core/app/dto/command.go index 275e3b180..fef7436fb 100644 --- a/core/app/dto/command.go +++ b/core/app/dto/command.go @@ -22,6 +22,7 @@ type CommandInfo struct { ID uint `json:"id"` GroupID uint `json:"groupID"` Name string `json:"name"` + Type string `json:"type"` Command string `json:"command"` GroupBelong string `json:"groupBelong"` } diff --git a/core/app/service/command.go b/core/app/service/command.go index 09bbaeb4f..fe3dba1f0 100644 --- a/core/app/service/command.go +++ b/core/app/service/command.go @@ -125,7 +125,7 @@ func (u *CommandService) Delete(ids []uint) error { func (u *CommandService) Update(req dto.CommandOperate) error { command, _ := commandRepo.Get(repo.WithByName(req.Name), repo.WithByType(req.Type)) - if command.ID != req.ID { + if command.ID != 0 && command.ID != req.ID { return buserr.New("ErrRecordExist") } upMap := make(map[string]interface{})