fix prefix

This commit is contained in:
xxj
2021-01-15 17:05:20 +08:00
parent 968898a767
commit 04a1abaed7
2 changed files with 5 additions and 19 deletions

View File

@@ -218,11 +218,6 @@ func (m *mysqlModel) getTables(orm *mysqldb.MySqlDB) map[string]string {
for rows.Next() { for rows.Next() {
var table string var table string
rows.Scan(&table) rows.Scan(&table)
tablePrefix := config.GetTablePrefix()
if tablePrefix != "" && !strings.Contains(table, tablePrefix) {
// 不包含前缀则跳过
continue
}
tables = append(tables, table) tables = append(tables, table)
tbDesc[table] = "" tbDesc[table] = ""
} }

View File

@@ -57,11 +57,7 @@ func (m *_Model) GetPackage() genstruct.GenPackage {
//如果设置了表前缀 //如果设置了表前缀
if tablePrefix != "" { if tablePrefix != "" {
var hasPrefix = strings.Contains(tab.Name, tablePrefix) tab.Name = strings.TrimLeft(tab.Name, tablePrefix)
if !hasPrefix {
// 不包含前缀则跳过
continue
}
} }
sct.SetStructName(getCamelName(tab.Name)) // Big hump.大驼峰 sct.SetStructName(getCamelName(tab.Name)) // Big hump.大驼峰
@@ -252,11 +248,6 @@ func (m *_Model) generateFunc() (genOut []GenOutInfo) {
// -------end------ // -------end------
for _, tab := range m.info.TabList { for _, tab := range m.info.TabList {
tablePrefix := config.GetTablePrefix()
if tablePrefix != "" && !strings.Contains(tab.Name, tablePrefix) {
// 不包含前缀则跳过
continue
}
var pkg genstruct.GenPackage var pkg genstruct.GenPackage
pkg.SetPackage(m.info.PackageName) //package name pkg.SetPackage(m.info.PackageName) //package name
pkg.AddImport(`"fmt"`) pkg.AddImport(`"fmt"`)