Merge pull request #142 from gh73962/master

修复表前缀的灵活性,修复windows下包名获取异常
This commit is contained in:
xxj
2021-05-31 17:57:33 +08:00
committed by GitHub
3 changed files with 6 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ func GetTablePrefixName(name string) string { //
tablePrefix := config.GetTablePrefix()
//如果设置了表前缀
if tablePrefix != "" {
return fmt.Sprintf("%v.%v", tablePrefix, name)
name = tablePrefix + name
}
return name

View File

@@ -98,7 +98,9 @@ func (m *cnfModel) GetPkgName() string {
}
if len(pkgName) == 0 || pkgName == "." {
list = strings.Split(tools.GetModelPath(), "/")
curDir := tools.GetModelPath()
curDir = strings.Replace(curDir, "\\", "/", -1)
list = strings.Split(curDir, "/")
if len(list) > 0 {
pkgName = list[len(list)-1]
}

View File

@@ -57,12 +57,12 @@ func (m *_Model) GetPackage() genstruct.GenPackage {
var pkg genstruct.GenPackage
pkg.SetPackage(m.info.PackageName) //package name
// tablePrefix := config.GetTablePrefix()
tablePrefix := config.GetTablePrefix()
for _, tab := range m.info.TabList {
var sct genstruct.GenStruct
sct.SetTableName(tab.Name)
sct.SetTableName(tablePrefix + tab.Name)
//如果设置了表前缀
// if tablePrefix != "" {