mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
Merge pull request #58 from kanzihuang/feature-export-databases
feat: 优化数据库批量导出功能
This commit is contained in:
@@ -342,6 +342,7 @@ const DbEdit = defineAsyncComponent(() => import('./DbEdit.vue'));
|
|||||||
const CreateTable = defineAsyncComponent(() => import('./CreateTable.vue'));
|
const CreateTable = defineAsyncComponent(() => import('./CreateTable.vue'));
|
||||||
|
|
||||||
const perms = {
|
const perms = {
|
||||||
|
base: 'db',
|
||||||
saveDb: 'db:save',
|
saveDb: 'db:save',
|
||||||
delDb: 'db:del',
|
delDb: 'db:del',
|
||||||
};
|
};
|
||||||
@@ -357,7 +358,7 @@ const columns = ref([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// 该用户拥有的的操作列按钮权限
|
// 该用户拥有的的操作列按钮权限
|
||||||
const actionBtns = hasPerms([perms.saveDb]);
|
const actionBtns = hasPerms([perms.base, perms.saveDb]);
|
||||||
const actionColumn = TableColumn.new('action', '操作').isSlot().setMinWidth(150).fixedRight().alignCenter();
|
const actionColumn = TableColumn.new('action', '操作').isSlot().setMinWidth(150).fixedRight().alignCenter();
|
||||||
|
|
||||||
const pageTableRef: any = ref(null);
|
const pageTableRef: any = ref(null);
|
||||||
|
|||||||
@@ -313,13 +313,7 @@ func selectDataByDb(db *sql.DB, selectSql string) ([]string, []map[string]any, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func walkTableRecord(db *sql.DB, selectSql string, walk func(record map[string]any, columns []string)) error {
|
func walkTableRecord(db *sql.DB, selectSql string, walk func(record map[string]any, columns []string)) error {
|
||||||
tx, err := db.Begin()
|
rows, err := db.Query(selectSql)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer tx.Rollback()
|
|
||||||
|
|
||||||
rows, err := tx.Query(selectSql)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -362,9 +356,6 @@ func walkTableRecord(db *sql.DB, selectSql string, walk func(record map[string]a
|
|||||||
walk(rowData, colNames)
|
walk(rowData, colNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.Commit(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user