You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.4 KiB
65 lines
1.4 KiB
package datacenter
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"appPlatform/overall/publicmethod"
|
|
"fmt"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-12-24 11:43:02
|
|
@ 功能: 获取数据表
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (a *ApiMethod) GainDataTable(c *gin.Context) {
|
|
var requestData DataBastType
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
publicmethod.Result(100, err, c)
|
|
return
|
|
}
|
|
if requestData.Type == "" {
|
|
publicmethod.Result(1, err, c, "未知数据库类型!请先确实是什么数据库类型!")
|
|
return
|
|
}
|
|
if requestData.DataBaseName == "" {
|
|
publicmethod.Result(1, err, c, "请输入数据库名称!")
|
|
return
|
|
}
|
|
if requestData.Ip == "" {
|
|
publicmethod.Result(1, err, c, "请输入数据库地址!")
|
|
return
|
|
}
|
|
|
|
if requestData.UserName == "" {
|
|
publicmethod.Result(1, err, c, "请输入用户名!")
|
|
return
|
|
}
|
|
if requestData.Pwd == "" {
|
|
publicmethod.Result(1, err, c, "请输入密码!")
|
|
return
|
|
}
|
|
tableInfo, err := requestData.ObtainDataBaseAllTableMysql()
|
|
fmt.Printf("tableInfo:%v\n", tableInfo)
|
|
for _, v := range tableInfo {
|
|
// if v.TableKey != "taskrecord" {
|
|
sql := fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN %v bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建人行政组织';", v.TableKey, "createrOrg")
|
|
overall.CONSTANT_DB_CustomerForm.Exec(sql)
|
|
// }
|
|
}
|
|
publicmethod.Result(0, tableInfo, c)
|
|
}
|
|
|