tablePrefix
This commit is contained in:
@@ -218,6 +218,11 @@ func (m *mysqlModel) getTables(orm *mysqldb.MySqlDB) map[string]string {
|
||||
for rows.Next() {
|
||||
var table string
|
||||
rows.Scan(&table)
|
||||
tablePrefix := config.GetTablePrefix()
|
||||
if tablePrefix != "" && !strings.Contains(table, tablePrefix) {
|
||||
// 不包含前缀则跳过
|
||||
continue
|
||||
}
|
||||
tables = append(tables, table)
|
||||
tbDesc[table] = ""
|
||||
}
|
||||
|
||||
@@ -57,7 +57,11 @@ func (m *_Model) GetPackage() genstruct.GenPackage {
|
||||
|
||||
//如果设置了表前缀
|
||||
if tablePrefix != "" {
|
||||
tab.Name = strings.TrimLeft(tab.Name, tablePrefix)
|
||||
var hasPrefix = strings.Contains(tab.Name, tablePrefix)
|
||||
if !hasPrefix {
|
||||
// 不包含前缀则跳过
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
sct.SetStructName(getCamelName(tab.Name)) // Big hump.大驼峰
|
||||
@@ -248,6 +252,11 @@ func (m *_Model) generateFunc() (genOut []GenOutInfo) {
|
||||
// -------end------
|
||||
|
||||
for _, tab := range m.info.TabList {
|
||||
tablePrefix := config.GetTablePrefix()
|
||||
if tablePrefix != "" && !strings.Contains(tab.Name, tablePrefix) {
|
||||
// 不包含前缀则跳过
|
||||
continue
|
||||
}
|
||||
var pkg genstruct.GenPackage
|
||||
pkg.SetPackage(m.info.PackageName) //package name
|
||||
pkg.AddImport(`"fmt"`)
|
||||
|
||||
Reference in New Issue
Block a user