This commit is contained in:
孟帅
2023-11-25 18:36:11 +08:00
parent 40117c700d
commit 70e9f966c3
142 changed files with 5407 additions and 2058 deletions

View File

@@ -34,7 +34,7 @@ func (l *gCurd) getPkField(in *CurdPreviewInput) *sysin.GenCodesColumnListModel
panic("getPkField masterFields uninitialized.")
}
for _, field := range in.masterFields {
if field.Index == consts.GenCodesIndexPK {
if IsIndexPK(field.Index) {
return field
}
}
@@ -165,3 +165,13 @@ func GetModName(ctx context.Context) (modName string, err error) {
}
return
}
// IsIndexPK 是否是主键
func IsIndexPK(index string) bool {
return gstr.ToUpper(index) == gstr.ToUpper(consts.GenCodesIndexPK)
}
// IsIndexUNI 是否是唯一索引
func IsIndexUNI(index string) bool {
return gstr.ToUpper(index) == gstr.ToUpper(consts.GenCodesIndexUNI)
}