From f55b9c661183ffa50a5441c33b7dcc885be49e56 Mon Sep 17 00:00:00 2001 From: SmileToCandy Date: Fri, 17 Mar 2023 10:36:16 +0000 Subject: [PATCH] =?UTF-8?q?readme=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SmileToCandy --- .idea/.gitignore | 8 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/tamguo.iml | 11 ++ .idea/uiDesigner.xml | 124 ++++++++++++++++++ .idea/vcs.xml | 6 + README.md | 3 +- .../tamguo/config/dao/MybatisPlusConfig.java | 55 +++++--- 8 files changed, 199 insertions(+), 22 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/tamguo.iml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a9ea907 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/tamguo.iml b/.idea/tamguo.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/.idea/tamguo.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index c2178b0..bdadb08 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ - 管理员账号:system 密码:123456 **因为线上数据和测试数据没有做到隔离,作者已经把密码修改,可用.sql在本地运行看后台效果。** -加QQ群:937899574 可免费获取SQL基本 +现在作者组建一个团队来对这个项目进行迭代升级,需要前端、后端、设计人员 +有兴趣加入的小伙伴,可以加作者微信: tamgoooo diff --git a/tamguo-mms/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java b/tamguo-mms/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java index 47d0386..a64c9fa 100644 --- a/tamguo-mms/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java +++ b/tamguo-mms/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java @@ -19,50 +19,58 @@ import com.baomidou.mybatisplus.plugins.parser.tenant.TenantSqlParser; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.LongValue; -@Configuration -@MapperScan("com.tamguo.modules.*.dao*") +/** + * MybatisPlusConfig 类,用于配置 Mybatis-Plus 的相关设置 + */ +@Configuration // 表示这是一个配置类 +@MapperScan("com.tamguo.modules.*.dao*") // 扫描指定包下的 Mapper 接口 public class MybatisPlusConfig { + /** + * 创建 PerformanceInterceptor 实例的方法 + * @return PerformanceInterceptor 性能拦截器实例 + */ @Bean public PerformanceInterceptor performanceInterceptor() { - return new PerformanceInterceptor(); + return new PerformanceInterceptor(); // 创建并返回性能拦截器实例 } /** - * mybatis-plus分页插件
- * 文档:http://mp.baomidou.com
+ * 创建 PaginationInterceptor 分页拦截器实例的方法 + * @return PaginationInterceptor 分页拦截器实例 */ @Bean public PaginationInterceptor paginationInterceptor() { - PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); - paginationInterceptor.setLocalPage(true);// 开启 PageHelper 的支持 + PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); // 创建分页拦截器实例 + paginationInterceptor.setLocalPage(true); // 开启 PageHelper 的支持 + /* - * 【测试多租户】 SQL 解析处理拦截器
- * 这里固定写成住户 1 实际情况你可以从cookie读取,因此数据看不到 【 麻花藤 】 这条记录( 注意观察 SQL )
+ * 【测试多租户】SQL 解析处理拦截器相关设置 */ - List sqlParserList = new ArrayList<>(); - TenantSqlParser tenantSqlParser = new TenantSqlParser(); - tenantSqlParser.setTenantHandler(new TenantHandler() { + List sqlParserList = new ArrayList<>(); // 创建 SQL 解析器列表 + TenantSqlParser tenantSqlParser = new TenantSqlParser(); // 创建租户 SQL 解析器实例 + + tenantSqlParser.setTenantHandler(new TenantHandler() { // 设置租户处理逻辑 @Override public Expression getTenantId() { - return new LongValue(1L); + return new LongValue(1L); // 返回表示租户 ID 的表达式 } @Override public String getTenantIdColumn() { - return "course_id"; + return "course_id"; // 返回租户 ID 所在的列名 } @Override public boolean doTableFilter(String tableName) { // 这里可以判断是否过滤表 - return true; + return true; // 返回是否过滤表的标志 } }); + sqlParserList.add(tenantSqlParser); // 将租户 SQL 解析器添加到列表中 + paginationInterceptor.setSqlParserList(sqlParserList); // 设置分页拦截器的 SQL 解析器列表 - sqlParserList.add(tenantSqlParser); - paginationInterceptor.setSqlParserList(sqlParserList); // 以下过滤方式与 @SqlParser(filter = true) 注解等效 // paginationInterceptor.setSqlParserFilter(new ISqlParserFilter() { // @Override @@ -78,16 +86,21 @@ public class MybatisPlusConfig { return paginationInterceptor; } + /** + * 创建 MetaObjectHandler 实例的方法 + * @return MetaObjectHandler 元对象处理实例 + */ @Bean public MetaObjectHandler metaObjectHandler(){ - return new MyMetaObjectHandler(); + return new MyMetaObjectHandler(); // 创建并返回元对象处理实例 } /** - * 注入sql注入器 + * 创建 ISqlInjector 实例的方法 + * @return ISqlInjector SQL 注入器实例 */ @Bean public ISqlInjector sqlInjector(){ - return new LogicSqlInjector(); + return new LogicSqlInjector(); // 创建并返回逻辑 SQL 注入器实例 } -} +} \ No newline at end of file