From 8b01334faf587edc47cb0015b14cde2a4b5b6402 Mon Sep 17 00:00:00 2001 From: hudangwei Date: Sat, 20 May 2017 13:06:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#440=20only=20get=20these=20tables=20info?= =?UTF-8?q?rmation=20in=20custom=20the=20option=20=E2=80=98-tables?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate/g_appcode.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/generate/g_appcode.go b/generate/g_appcode.go index f575568..421b407 100644 --- a/generate/g_appcode.go +++ b/generate/g_appcode.go @@ -298,7 +298,14 @@ func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, ap defer db.Close() if trans, ok := dbDriver[dbms]; ok { beeLogger.Log.Info("Analyzing database tables...") - tableNames := trans.GetTableNames(db) + var tableNames []string + if len(selectedTableNames) != 0 { + for tableName := range selectedTableNames { + tableNames = append(tableNames, tableName) + } + } else { + tableNames = trans.GetTableNames(db) + } tables := getTableObjects(tableNames, db, trans) mvcPath := new(MvcPath) mvcPath.ModelPath = path.Join(apppath, "models")