From 79bf3dfdf5138cbc65d74c444aa2f5428eef5373 Mon Sep 17 00:00:00 2001 From: Dftre <3066417822@qq.com> Date: Wed, 8 Jan 2025 12:24:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(online):=20=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=20OnlineMb=20=E4=B8=AD=E7=9A=84=20sql=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E4=B8=BA=20sqlText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 OnlineMb 类中,将 sql 属性重命名为 sqlText - 更新了相关的 getter 和 setter 方法 - 修改了 mapper 文件中的对应字段 - 调整了 SQL 查询语句中的字段名称 --- .../online/controller/OnLineController.java | 2 +- .../com/ruoyi/online/domain/OnlineMb.java | 12 ++++----- .../mapper/online/OnlineMbMapper.xml | 26 +++++++++---------- sql/mysql/create_database.sql | 4 +-- sql/mysql/online.sql | 2 +- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/controller/OnLineController.java b/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/controller/OnLineController.java index 187d4f0..32a945b 100644 --- a/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/controller/OnLineController.java +++ b/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/controller/OnLineController.java @@ -134,7 +134,7 @@ public class OnLineController extends BaseController { if (onlineMb.getUserId() != null && onlineMb.getUserId().equals("1")) { object.put("userId", SecurityUtils.getUserId()); } - return processingMapper(onlineMb.getSql(), onlineMb.getActuator(), object); + return processingMapper(onlineMb.getSqlText(), onlineMb.getActuator(), object); } } diff --git a/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/domain/OnlineMb.java b/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/domain/OnlineMb.java index a2e410a..8f2d075 100644 --- a/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/domain/OnlineMb.java +++ b/ruoyi-models/ruoyi-online/src/main/java/com/ruoyi/online/domain/OnlineMb.java @@ -45,7 +45,7 @@ public class OnlineMb extends BaseEntity { /** sql语句 */ @Schema(title = "sql语句") @Excel(name = "sql语句") - private String sql; + private String sqlText; /** 请求路径 */ @Schema(title = "请求路径") @@ -159,12 +159,12 @@ public class OnlineMb extends BaseEntity { return resultMap; } - public void setSql(String sql) { - this.sql = sql; + public void setSqlText(String sqlText) { + this.sqlText = sqlText; } - public String getSql() { - return sql; + public String getSqlText() { + return sqlText; } public void setPath(String path) { @@ -207,7 +207,7 @@ public class OnlineMb extends BaseEntity { .append("tagId", getTagId()) .append("parameterType", getParameterType()) .append("resultMap", getResultMap()) - .append("sql", getSql()) + .append("sqlText", getSqlText()) .append("path", getPath()) .append("method", getMethod()) .append("resultType", getResultType()) diff --git a/ruoyi-models/ruoyi-online/src/main/resources/mapper/online/OnlineMbMapper.xml b/ruoyi-models/ruoyi-online/src/main/resources/mapper/online/OnlineMbMapper.xml index 1e03f18..547cfe8 100644 --- a/ruoyi-models/ruoyi-online/src/main/resources/mapper/online/OnlineMbMapper.xml +++ b/ruoyi-models/ruoyi-online/src/main/resources/mapper/online/OnlineMbMapper.xml @@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -22,19 +22,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select mb_id, tag, tag_id, parameter_type, result_map, `sql`, `path`, method, result_type, actuator,user_id,dept_id,permission_type,permission_value from online_mb + select mb_id, tag, tag_id, parameter_type, result_map, sql_text, online_mb.path, method, result_type, actuator,user_id,dept_id,permission_type,permission_value from online_mb - where online_mb.mb_id = #{mbId} and online_mb.del_flag != 1 + where online_mb.mb_id = #{mbId} and online_mb.del_flag != '1' @@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tag_id, parameter_type, result_map, - `sql`, + sql_text, path, method, result_type, @@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{tagId}, #{parameterType}, #{resultMap}, - #{sql}, + #{sqlText}, #{path}, #{method}, #{resultType}, @@ -93,8 +93,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tag_id = #{tagId}, parameter_type = #{parameterType}, result_map = #{result_map}, - `sql` = #{sql}, - `path` = #{path}, + sql_text = #{sqlText}, + path = #{path}, method = #{method}, result_type = #{resultType}, actuator = #{actuator}, @@ -103,15 +103,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" permission_type = #{permissionType}, permission_value = #{permissionValue}, - where online_mb.mb_id = #{mbId} and online_mb.del_flag != 1 + where online_mb.mb_id = #{mbId} and online_mb.del_flag != '1' - update online_mb set del_flag = 1 where mb_id = #{mbId} + update online_mb set del_flag = '1' where mb_id = #{mbId} - update online_mb set del_flag = 1 where mb_id in + update online_mb set del_flag = '1' where mb_id in #{mbId} diff --git a/sql/mysql/create_database.sql b/sql/mysql/create_database.sql index 8f22854..6592849 100644 --- a/sql/mysql/create_database.sql +++ b/sql/mysql/create_database.sql @@ -1,3 +1 @@ -CREATE DATABASE IF NOT EXISTS ry -CHARACTER SET utf8mb4 -COLLATE utf8mb4_general_ci; \ No newline at end of file +CREATE DATABASE IF NOT EXISTS ry CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; \ No newline at end of file diff --git a/sql/mysql/online.sql b/sql/mysql/online.sql index cfc33d0..df99eae 100644 --- a/sql/mysql/online.sql +++ b/sql/mysql/online.sql @@ -6,7 +6,7 @@ CREATE TABLE online_mb ( tag_id varchar(255) NULL COMMENT '标签id', parameter_type varchar(255) NULL COMMENT '参数类型', result_map varchar(255) NULL COMMENT '结果类型', - `sql` varchar(255) NULL COMMENT 'sql语句', + sql_text varchar(255) NULL COMMENT 'sql语句', path varchar(255) NULL COMMENT '请求路径', method varchar(255) NULL COMMENT '请求方式', result_type varchar(255) NULL COMMENT '响应类型',