@@ -218,6 +218,11 @@ 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] = ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,11 @@ func (m *_Model) GetPackage() genstruct.GenPackage {
|
|||||||
|
|
||||||
//如果设置了表前缀
|
//如果设置了表前缀
|
||||||
if tablePrefix != "" {
|
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.大驼峰
|
sct.SetStructName(getCamelName(tab.Name)) // Big hump.大驼峰
|
||||||
@@ -248,6 +252,11 @@ 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"`)
|
||||||
|
|||||||
Reference in New Issue
Block a user