fix: 解决删除数据库过程中导致的锁库

This commit is contained in:
zhengkunwang223
2022-12-27 16:30:25 +08:00
committed by zhengkunwang223
parent aa9f6f0f2b
commit f8409fbfaf
5 changed files with 13 additions and 65 deletions

View File

@@ -227,10 +227,13 @@ func (b *BaseApi) DeleteMysql(c *gin.Context) {
return
}
if err := mysqlService.Delete(req); err != nil {
tx, ctx := helper.GetTxAndContext()
if err := mysqlService.Delete(ctx, req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
tx.Rollback()
return
}
tx.Commit()
helper.SuccessWithData(c, nil)
}