Merge pull request #4738 from flycash/fix4728

Fix 4734: do not reset id in Delete function
This commit is contained in:
Ming Deng 2021-08-19 21:52:06 +08:00 committed by GitHub
commit 29123f7d81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View File

@ -59,6 +59,7 @@
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737) - Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715) - fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735) - Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735)
- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738)
## Fix Sonar ## Fix Sonar

View File

@ -282,13 +282,7 @@ func (o *ormBase) Delete(md interface{}, cols ...string) (int64, error) {
func (o *ormBase) DeleteWithCtx(ctx context.Context, md interface{}, cols ...string) (int64, error) { func (o *ormBase) DeleteWithCtx(ctx context.Context, md interface{}, cols ...string) (int64, error) {
mi, ind := o.getMiInd(md, true) mi, ind := o.getMiInd(md, true)
num, err := o.alias.DbBaser.Delete(ctx, o.db, mi, ind, o.alias.TZ, cols) num, err := o.alias.DbBaser.Delete(ctx, o.db, mi, ind, o.alias.TZ, cols)
if err != nil { return num, err
return num, err
}
if num > 0 {
o.setPk(mi, ind, 0)
}
return num, nil
} }
// create a models to models queryer // create a models to models queryer