bug fixed #297
This commit is contained in:
parent
803f6db50c
commit
300379e016
|
@ -3565,7 +3565,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
|
||||||
colNames, args = buildUpdates(session.Engine, table, bean, false, false,
|
colNames, args = buildUpdates(session.Engine, table, bean, false, false,
|
||||||
false, false, session.Statement.allUseBool, session.Statement.useAllCols,
|
false, false, session.Statement.allUseBool, session.Statement.useAllCols,
|
||||||
session.Statement.mustColumnMap, session.Statement.nullableMap,
|
session.Statement.mustColumnMap, session.Statement.nullableMap,
|
||||||
session.Statement.columnMap, true)
|
session.Statement.columnMap, true, session.Statement.unscoped)
|
||||||
} else {
|
} else {
|
||||||
colNames, args, err = genCols(table, session, bean, true, true)
|
colNames, args, err = genCols(table, session, bean, true, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -182,7 +182,7 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
||||||
includeVersion bool, includeUpdated bool, includeNil bool,
|
includeVersion bool, includeUpdated bool, includeNil bool,
|
||||||
includeAutoIncr bool, allUseBool bool, useAllCols bool,
|
includeAutoIncr bool, allUseBool bool, useAllCols bool,
|
||||||
mustColumnMap map[string]bool, nullableMap map[string]bool,
|
mustColumnMap map[string]bool, nullableMap map[string]bool,
|
||||||
columnMap map[string]bool, update bool) ([]string, []interface{}) {
|
columnMap map[string]bool, update, unscoped bool) ([]string, []interface{}) {
|
||||||
|
|
||||||
colNames := make([]string, 0)
|
colNames := make([]string, 0)
|
||||||
var args = make([]interface{}, 0)
|
var args = make([]interface{}, 0)
|
||||||
|
@ -199,7 +199,7 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
||||||
if !includeAutoIncr && col.IsAutoIncrement {
|
if !includeAutoIncr && col.IsAutoIncrement {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if col.IsDeleted {
|
if col.IsDeleted && !unscoped {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if use, ok := columnMap[col.Name]; ok && !use {
|
if use, ok := columnMap[col.Name]; ok && !use {
|
||||||
|
|
Loading…
Reference in New Issue