|
@@ -490,9 +490,8 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|
|
args := make([]interface{}, 0, len(table.ColumnsSeq()))
|
|
args := make([]interface{}, 0, len(table.ColumnsSeq()))
|
|
|
|
|
|
|
|
for _, col := range table.Columns() {
|
|
for _, col := range table.Columns() {
|
|
|
- lColName := strings.ToLower(col.Name)
|
|
|
|
|
if useCol && !col.IsVersion && !col.IsCreated && !col.IsUpdated {
|
|
if useCol && !col.IsVersion && !col.IsCreated && !col.IsUpdated {
|
|
|
- if _, ok := session.Statement.columnMap[lColName]; !ok {
|
|
|
|
|
|
|
+ if _, ok := getFlagForColumn(session.Statement.columnMap, col); !ok {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -528,18 +527,18 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if session.Statement.ColumnStr != "" {
|
|
if session.Statement.ColumnStr != "" {
|
|
|
- if _, ok := session.Statement.columnMap[lColName]; !ok {
|
|
|
|
|
|
|
+ if _, ok := getFlagForColumn(session.Statement.columnMap, col); !ok {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if session.Statement.OmitStr != "" {
|
|
if session.Statement.OmitStr != "" {
|
|
|
- if _, ok := session.Statement.columnMap[lColName]; ok {
|
|
|
|
|
|
|
+ if _, ok := getFlagForColumn(session.Statement.columnMap, col); ok {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// !evalphobia! set fieldValue as nil when column is nullable and zero-value
|
|
// !evalphobia! set fieldValue as nil when column is nullable and zero-value
|
|
|
- if _, ok := session.Statement.nullableMap[lColName]; ok {
|
|
|
|
|
|
|
+ if _, ok := getFlagForColumn(session.Statement.nullableMap, col); ok {
|
|
|
if col.Nullable && isZero(fieldValue.Interface()) {
|
|
if col.Nullable && isZero(fieldValue.Interface()) {
|
|
|
var nilValue *int
|
|
var nilValue *int
|
|
|
fieldValue = reflect.ValueOf(nilValue)
|
|
fieldValue = reflect.ValueOf(nilValue)
|
|
@@ -578,3 +577,23 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|
|
func indexName(tableName, idxName string) string {
|
|
func indexName(tableName, idxName string) string {
|
|
|
return fmt.Sprintf("IDX_%v_%v", tableName, idxName)
|
|
return fmt.Sprintf("IDX_%v_%v", tableName, idxName)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func getFlagForColumn(m map[string]bool, col *core.Column) (val bool, has bool) {
|
|
|
|
|
+
|
|
|
|
|
+ if len(m) == 0 {
|
|
|
|
|
+ return false, false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ n := len(col.Name)
|
|
|
|
|
+
|
|
|
|
|
+ for mk := range m {
|
|
|
|
|
+ if len(mk) != n {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+ if strings.EqualFold(mk, col.Name) {
|
|
|
|
|
+ return m[mk], true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return false, false
|
|
|
|
|
+}
|