@@ -106,13 +106,15 @@ func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) {
106106// @Success   200  {object}  response.Response{data=map[string]interface{},msg=string}  "获取当前所有数据库" 
107107// @Router    /autoCode/getDatabase [get] 
108108func  (autoApi  * AutoCodeApi ) GetDB (c  * gin.Context ) {
109- 	dbs , err  :=  autoCodeService .Database ().GetDB ()
109+ 	businessDB  :=  c .Query ("businessDB" )
110+ 	dbs , err  :=  autoCodeService .Database (businessDB ).GetDB (businessDB )
110111	var  dbList  []map [string ]interface {}
111112	for  _ , db  :=  range  global .GVA_CONFIG .DBList  {
112113		var  item  =  make (map [string ]interface {})
113114		item ["aliasName" ] =  db .AliasName 
114115		item ["dbName" ] =  db .Dbname 
115116		item ["disable" ] =  db .Disable 
117+ 		item ["dbtype" ] =  db .Type 
116118		dbList  =  append (dbList , item )
117119	}
118120	if  err  !=  nil  {
@@ -133,7 +135,8 @@ func (autoApi *AutoCodeApi) GetDB(c *gin.Context) {
133135// @Router    /autoCode/getTables [get] 
134136func  (autoApi  * AutoCodeApi ) GetTables (c  * gin.Context ) {
135137	dbName  :=  c .DefaultQuery ("dbName" , global .GVA_CONFIG .Mysql .Dbname )
136- 	tables , err  :=  autoCodeService .Database ().GetTables (dbName )
138+ 	businessDB  :=  c .Query ("businessDB" )
139+ 	tables , err  :=  autoCodeService .Database (businessDB ).GetTables (businessDB , dbName )
137140	if  err  !=  nil  {
138141		global .GVA_LOG .Error ("查询table失败!" , zap .Error (err ))
139142		response .FailWithMessage ("查询table失败" , c )
@@ -151,9 +154,10 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) {
151154// @Success   200  {object}  response.Response{data=map[string]interface{},msg=string}  "获取当前表所有字段" 
152155// @Router    /autoCode/getColumn [get] 
153156func  (autoApi  * AutoCodeApi ) GetColumn (c  * gin.Context ) {
157+ 	businessDB  :=  c .Query ("businessDB" )
154158	dbName  :=  c .DefaultQuery ("dbName" , global .GVA_CONFIG .Mysql .Dbname )
155159	tableName  :=  c .Query ("tableName" )
156- 	columns , err  :=  autoCodeService .Database ().GetColumn (tableName , dbName )
160+ 	columns , err  :=  autoCodeService .Database (businessDB ).GetColumn (businessDB ,  tableName , dbName )
157161	if  err  !=  nil  {
158162		global .GVA_LOG .Error ("获取失败!" , zap .Error (err ))
159163		response .FailWithMessage ("获取失败" , c )
0 commit comments