fix non-int pk issues

This commit is contained in:
Apphost 2015-03-09 22:00:34 +08:00
parent b2b60e569f
commit 16b813a159
1 changed files with 3 additions and 1 deletions

View File

@ -599,7 +599,9 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
if table, ok := engine.Tables[fieldValue.Type()]; ok {
if len(table.PrimaryKeys) == 1 {
pkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)
if pkField.Int() != 0 {
// fix non-int pk issues
//if pkField.Int() != 0 {
if pkField.IsValid() {
val = pkField.Interface()
} else {
continue