From 4d2e110e1ed26b404b1eb6044869d76f52ebfec9 Mon Sep 17 00:00:00 2001 From: wanli Date: Thu, 7 Sep 2023 11:15:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=AF=BC=E5=87=BA=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mayfly_go_web/src/views/ops/db/DbList.vue | 3 ++- server/internal/db/application/db.go | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/mayfly_go_web/src/views/ops/db/DbList.vue b/mayfly_go_web/src/views/ops/db/DbList.vue index ce74d6c7..5f32cc0e 100644 --- a/mayfly_go_web/src/views/ops/db/DbList.vue +++ b/mayfly_go_web/src/views/ops/db/DbList.vue @@ -342,6 +342,7 @@ const DbEdit = defineAsyncComponent(() => import('./DbEdit.vue')); const CreateTable = defineAsyncComponent(() => import('./CreateTable.vue')); const perms = { + base: 'db', saveDb: 'db:save', 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 pageTableRef: any = ref(null); diff --git a/server/internal/db/application/db.go b/server/internal/db/application/db.go index e4cce146..11ae19c4 100644 --- a/server/internal/db/application/db.go +++ b/server/internal/db/application/db.go @@ -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 { - tx, err := db.Begin() - if err != nil { - return err - } - defer tx.Rollback() - - rows, err := tx.Query(selectSql) + rows, err := db.Query(selectSql) if err != nil { return err } @@ -362,9 +356,6 @@ func walkTableRecord(db *sql.DB, selectSql string, walk func(record map[string]a walk(rowData, colNames) } - if err := tx.Commit(); err != nil { - return err - } return nil }