mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-02-10 23:05:37 +08:00
!88 feat: dbms表支持右键菜单:删除表、编辑表、新建表、复制表
* feat: 支持复制表 * feat: dbms表支持右键菜单:删除表、编辑表、新建表
This commit is contained in:
@@ -462,6 +462,20 @@ func (d *Db) GetSchemas(rc *req.Ctx) {
|
||||
rc.ResData = res
|
||||
}
|
||||
|
||||
func (d *Db) CopyTable(rc *req.Ctx) {
|
||||
form := &form.DbCopyTableForm{}
|
||||
copy := ginx.BindJsonAndCopyTo[*dbi.DbCopyTable](rc.GinCtx, form, new(dbi.DbCopyTable))
|
||||
|
||||
conn, err := d.DbApp.GetDbConn(form.Id, form.Db)
|
||||
biz.ErrIsNilAppendErr(err, "拷贝表失败: %s")
|
||||
|
||||
err = conn.GetDialect().CopyTable(copy)
|
||||
if err != nil {
|
||||
logx.Errorf("拷贝表失败: %s", err.Error())
|
||||
}
|
||||
biz.ErrIsNilAppendErr(err, "拷贝表失败: %s")
|
||||
}
|
||||
|
||||
func getDbId(g *gin.Context) uint64 {
|
||||
dbId, _ := strconv.Atoi(g.Param("dbId"))
|
||||
biz.IsTrue(dbId > 0, "dbId错误")
|
||||
|
||||
@@ -23,3 +23,11 @@ type DbSqlExecForm struct {
|
||||
Sql string `binding:"required" json:"sql"` // 执行sql
|
||||
Remark string `json:"remark"` // 执行备注
|
||||
}
|
||||
|
||||
// 数据库复制表
|
||||
type DbCopyTableForm struct {
|
||||
Id uint64 `binding:"required" json:"id"`
|
||||
Db string `binding:"required" json:"db" `
|
||||
TableName string `binding:"required" json:"tableName"`
|
||||
CopyData bool `binding:"required" json:"copyData"` // 是否复制数据
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user