From e4d949a64befaae91d95b3d5ddb54df7da199e97 Mon Sep 17 00:00:00 2001
From: "meilin.huang" <954537473@qq.com>
Date: Thu, 26 Dec 2024 12:17:58 +0800
Subject: [PATCH] fix: machine file bug
---
frontend/src/theme/element.scss | 35 ++++++++-----------
frontend/src/views/ops/db/DbSqlExecLog.vue | 2 +-
.../views/ops/machine/file/MachineFile.vue | 4 +--
.../views/system/resource/ResourceEdit.vue | 22 ++++++------
server/internal/db/application/db.go | 2 +-
server/internal/db/application/db_sql_exec.go | 4 +--
.../db/dbm/sqlparser/mysql/visitor.go | 20 ++++++-----
.../db/dbm/sqlparser/sqlstmt/common.go | 8 +++++
8 files changed, 52 insertions(+), 45 deletions(-)
diff --git a/frontend/src/theme/element.scss b/frontend/src/theme/element.scss
index 73a7fee8..03de6a5f 100644
--- a/frontend/src/theme/element.scss
+++ b/frontend/src/theme/element.scss
@@ -12,30 +12,25 @@
/* Form 表单
------------------------------- */
-.el-form {
+// .el-form {
- // 用于修改弹窗时表单内容间隔太大问题,如系统设置的新增菜单弹窗里的表单内容
- .el-form-item:last-of-type {
- margin-bottom: 0 !important;
- }
+// // 修复行内表单最后一个 el-form-item 位置下移问题
+// &.el-form--inline {
+// .el-form-item--large.el-form-item:last-of-type {
+// margin-bottom: 22px !important;
+// }
- // 修复行内表单最后一个 el-form-item 位置下移问题
- &.el-form--inline {
- .el-form-item--large.el-form-item:last-of-type {
- margin-bottom: 22px !important;
- }
+// .el-form-item--default.el-form-item:last-of-type,
+// .el-form-item--small.el-form-item:last-of-type {
+// margin-bottom: 18px !important;
+// }
+// }
- .el-form-item--default.el-form-item:last-of-type,
- .el-form-item--small.el-form-item:last-of-type {
- margin-bottom: 18px !important;
- }
- }
- // https://gitee.com/lyt-top/vue-next-admin/issues/I5K1PM
- .el-form-item .el-form-item__label .el-icon {
- margin-right: 0px;
- }
-}
+// .el-form-item .el-form-item__label .el-icon {
+// margin-right: 0px;
+// }
+// }
/* Alert 警告
------------------------------- */
diff --git a/frontend/src/views/ops/db/DbSqlExecLog.vue b/frontend/src/views/ops/db/DbSqlExecLog.vue
index 3feba710..bb2e5595 100644
--- a/frontend/src/views/ops/db/DbSqlExecLog.vue
+++ b/frontend/src/views/ops/db/DbSqlExecLog.vue
@@ -66,7 +66,7 @@ const searchItems = [
const columns = ref([
TableColumn.new('db', 'db.db'),
- TableColumn.new('table', 'db.type'),
+ TableColumn.new('table', 'db.table'),
TableColumn.new('type', 'db.stmtType').typeTag(DbSqlExecTypeEnum).setAddWidth(10),
TableColumn.new('creator', 'db.execUser'),
TableColumn.new('sql', 'SQL').canBeautify(),
diff --git a/frontend/src/views/ops/machine/file/MachineFile.vue b/frontend/src/views/ops/machine/file/MachineFile.vue
index 3711195e..d7bc26cf 100755
--- a/frontend/src/views/ops/machine/file/MachineFile.vue
+++ b/frontend/src/views/ops/machine/file/MachineFile.vue
@@ -273,8 +273,8 @@
- {{ $t('machine.file') }}
- {{ $t('machine.folder') }}
+ {{ $t('machine.folder') }}
+ {{ $t('machine.file') }}
diff --git a/frontend/src/views/system/resource/ResourceEdit.vue b/frontend/src/views/system/resource/ResourceEdit.vue
index 4747313e..16a52fd5 100644
--- a/frontend/src/views/system/resource/ResourceEdit.vue
+++ b/frontend/src/views/system/resource/ResourceEdit.vue
@@ -3,17 +3,17 @@
-
+
-
+
-
+
path|code
@@ -26,12 +26,12 @@
-
+
-
+
{{ $t('system.menu.routerName') }}
@@ -44,7 +44,7 @@
-
+
{{ $t('system.menu.componentPath') }}
@@ -57,7 +57,7 @@
-
+
{{ $t('system.menu.isCache') }}
@@ -72,7 +72,7 @@
-
+
{{ $t('system.menu.isHide') }}
@@ -87,14 +87,14 @@
-
+
-
+
{{ $t('system.menu.externalLink') }}
@@ -111,7 +111,7 @@
-
+
diff --git a/server/internal/db/application/db.go b/server/internal/db/application/db.go
index cf8ddd9f..71f140fa 100644
--- a/server/internal/db/application/db.go
+++ b/server/internal/db/application/db.go
@@ -308,7 +308,7 @@ func (d *dbAppImpl) DumpDb(ctx context.Context, reqParam *dto.DumpDb) error {
}
if len(tbs) <= 0 {
log(fmt.Sprintf("failed to get table [%s] information: No table information was retrieved", tableName))
- return errorx.NewBiz(fmt.Sprintf("Failed to get table information: %s", tableName))
+ return errorx.NewBiz("Failed to get table information: %s", tableName)
}
tableInfo := tbs[0]
diff --git a/server/internal/db/application/db_sql_exec.go b/server/internal/db/application/db_sql_exec.go
index 08d96d8c..13307987 100644
--- a/server/internal/db/application/db_sql_exec.go
+++ b/server/internal/db/application/db_sql_exec.go
@@ -446,11 +446,11 @@ func (d *dbSqlExecAppImpl) doUpdate(ctx context.Context, sqlExecParam *sqlExecPa
}
execRecord.Table = tableName
- whereStr := updatestmt.Where.GetText()
- if whereStr == "" {
+ if updatestmt.Where == nil {
logx.ErrorContext(ctx, "update SQL - there is no where condition")
return d.doExec(ctx, dbConn, sqlExecParam.Sql)
}
+ whereStr := updatestmt.Where.GetText()
// 获取表主键列名,排除使用别名
primaryKey, err := dbConn.GetMetadata().GetPrimaryKey(tableName)
diff --git a/server/internal/db/dbm/sqlparser/mysql/visitor.go b/server/internal/db/dbm/sqlparser/mysql/visitor.go
index f9093ac4..aa57e696 100644
--- a/server/internal/db/dbm/sqlparser/mysql/visitor.go
+++ b/server/internal/db/dbm/sqlparser/mysql/visitor.go
@@ -441,23 +441,27 @@ func (v *MysqlVisitor) VisitInPredicate(ctx *mysqlparser.InPredicateContext) int
}
func (v *MysqlVisitor) VisitBetweenPredicate(ctx *mysqlparser.BetweenPredicateContext) interface{} {
- node := sqlstmt.NewNode(ctx.GetParser(), ctx)
- return node
+ predicate := new(sqlstmt.PredicateLike)
+ predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
+ return predicate
}
func (v *MysqlVisitor) VisitIsNullPredicate(ctx *mysqlparser.IsNullPredicateContext) interface{} {
- node := sqlstmt.NewNode(ctx.GetParser(), ctx)
- return node
+ predicate := new(sqlstmt.PredicateLike)
+ predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
+ return predicate
}
func (v *MysqlVisitor) VisitLikePredicate(ctx *mysqlparser.LikePredicateContext) interface{} {
- node := sqlstmt.NewNode(ctx.GetParser(), ctx)
- return node
+ likePredicate := new(sqlstmt.PredicateLike)
+ likePredicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
+ return likePredicate
}
func (v *MysqlVisitor) VisitRegexpPredicate(ctx *mysqlparser.RegexpPredicateContext) interface{} {
- node := sqlstmt.NewNode(ctx.GetParser(), ctx)
- return node
+ predicate := new(sqlstmt.PredicateLike)
+ predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
+ return predicate
}
func (v *MysqlVisitor) VisitUnaryExpressionAtom(ctx *mysqlparser.UnaryExpressionAtomContext) interface{} {
diff --git a/server/internal/db/dbm/sqlparser/sqlstmt/common.go b/server/internal/db/dbm/sqlparser/sqlstmt/common.go
index 774fa8f2..223bd3c1 100644
--- a/server/internal/db/dbm/sqlparser/sqlstmt/common.go
+++ b/server/internal/db/dbm/sqlparser/sqlstmt/common.go
@@ -59,6 +59,14 @@ type (
ExprAtom IExprAtom
}
+
+ PredicateLike struct {
+ Predicate
+
+ InPredicate IPredicate
+ Exprs []IExpr
+ SelectStmt ISelectStmt
+ }
)
func (*Predicate) isPredicate() {}