bug fixed
This commit is contained in:
parent
26932e9b90
commit
ede84cde60
|
@ -3367,7 +3367,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
|
||||||
if session.Statement.ColumnStr == "" {
|
if session.Statement.ColumnStr == "" {
|
||||||
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, true)
|
session.Statement.mustColumnMap, session.Statement.columnMap, true)
|
||||||
} 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 {
|
||||||
|
|
|
@ -286,7 +286,7 @@ func (statement *Statement) Table(tableNameOrBean interface{}) *Statement {
|
||||||
func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
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, update bool) ([]string, []interface{}) {
|
mustColumnMap map[string]bool, columnMap map[string]bool, update bool) ([]string, []interface{}) {
|
||||||
|
|
||||||
colNames := make([]string, 0)
|
colNames := make([]string, 0)
|
||||||
var args = make([]interface{}, 0)
|
var args = make([]interface{}, 0)
|
||||||
|
@ -306,6 +306,9 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
||||||
if col.IsDeleted {
|
if col.IsDeleted {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if use, ok := columnMap[col.Name]; ok && !use {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if engine.dialect.DBType() == core.MSSQL && col.SQLType.Name == core.Text {
|
if engine.dialect.DBType() == core.MSSQL && col.SQLType.Name == core.Text {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue