Update model.go

master
谢小军 4 years ago
parent 46831f3501
commit a89988d711

@ -165,8 +165,6 @@ func (m *_Model) genForeignKey(col ColumnsInfo) (fklist []genstruct.GenElement)
} }
func (m *_Model) getColumnsKeyMulti(tableName, col string) (isMulti bool, isFind bool, notes string) { func (m *_Model) getColumnsKeyMulti(tableName, col string) (isMulti bool, isFind bool, notes string) {
isMulti = true
var haveGomod bool var haveGomod bool
for _, v := range m.info.TabList { for _, v := range m.info.TabList {
if strings.EqualFold(v.Name, tableName) { if strings.EqualFold(v.Name, tableName) {
@ -177,8 +175,7 @@ func (m *_Model) getColumnsKeyMulti(tableName, col string) (isMulti bool, isFind
case ColumnsKeyPrimary, ColumnsKeyUnique, ColumnsKeyUniqueIndex: // primary key unique key . 主键,唯一索引 case ColumnsKeyPrimary, ColumnsKeyUnique, ColumnsKeyUniqueIndex: // primary key unique key . 主键,唯一索引
{ {
if !v2.Multi { if !v2.Multi {
isMulti = false return false, true, v.Notes
break
} }
} }
// case ColumnsKeyIndex: // index key. 复合索引 // case ColumnsKeyIndex: // index key. 复合索引
@ -187,7 +184,7 @@ func (m *_Model) getColumnsKeyMulti(tableName, col string) (isMulti bool, isFind
// } // }
} }
} }
return isMulti, true, v.Notes return true, true, v.Notes
} else if strings.EqualFold(v1.Type, "gorm.Model") { } else if strings.EqualFold(v1.Type, "gorm.Model") {
haveGomod = true haveGomod = true
notes = v.Notes notes = v.Notes

Loading…
Cancel
Save