若依(前后端分离版)整合Mybatis-puls
详细可以查看官方帮助文档
1. ruoyi-common\pom.xml 添加 Mybatis-plus 整合依赖。
<!-- mybatis-plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.1</version></dependency>
2. ruoyi-admin 文件 application.yml ,修改 mybatis为mybatis-plus 。
# MyBatis-plus配置
mybatis-plus:# 搜索指定包别名typeAliasesPackage: com.ruoyi.**.domain# 配置mapper的扫描,找到所有的mapper.xml映射文件mapperLocations: classpath*:mapper/**/*Mapper.xml# 加载全局的配置文件configLocation: classpath:mybatis/mybatis-config.xml
3. ruoyi-framework/config 添加 Mybatis-Plus 配置类 MybatisPlusConfig.java 。原本的 MybatisConfig.java 注释/删除掉。
package com.ruoyi.framework.config;import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;/*** Mybatis Plus 配置** @author Will*/
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig
{@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();// 分页插件interceptor.addInnerInterceptor(paginationInnerInterceptor());// 乐观锁插件interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());// 阻断插件interceptor.addInnerInterceptor(blockAttackInnerInterceptor());return interceptor;}/*** 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html*/public PaginationInnerInterceptor paginationInnerInterceptor(){PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();// 设置数据库类型为mysqlpaginationInnerInterceptor.setDbType(DbType.MYSQL);// 设置最大单页限制数量,默认 500 条,-1 不受限制paginationInnerInterceptor.setMaxLimit(-1L);return paginationInnerInterceptor;}/*** 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html*/public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor(){return new OptimisticLockerInnerInterceptor();}/*** 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html*/public BlockAttackInnerInterceptor blockAttackInnerInterceptor(){return new BlockAttackInnerInterceptor();}
}
到这一步就整合完了,项目可以重新启动成功。
以上转自,且更多内容请查看若依前端分离版整合mybatis-plus_淡月斜阳的博客-CSDN博客_若依整合mybatisplus
若依前端分离版整合mybatis-plus_淡月斜阳的博客-CSDN博客_若依整合mybatisplushttps://blog.csdn.net/u013922289/article/details/125043761
若依(前后端分离版)整合Mybatis-puls相关推荐
- 若依前后端分离版整合Mybatis-puls
前提:默认在git上拉完代码,可以本地启动.(因为修改过项目名称所以hy可以理解为原来的ry) 1.修改配置文件 文件名:hy-admin/src/main/resources/application ...
- 使用SpringBoot + Vue (若依前后端分离版) 写项目的一些总结(持续更新...)
使用SpringBoot + Vue(若依前后端分离版) 写项目的一些总结 获取Redis服务 @Autowired private RedisCache redisCache; String cap ...
- 若依前后端分离版手把手教你本地搭建环境并运行项目
场景 RuoYi-Vue是一款基于SpringBoot+Vue的前后端分离极速后台开发框架. RuoYi 官网地址:http://ruoyi.vip RuoYi 在线文档:http://doc.ruo ...
- ssm vue架构图_ssm+vue前后端分离框架整合实现(附源码)
前言 本文针对Spring+SpringMVC+Mybatis后台开发框架(基于maven构建)与vue前端框架(基于webpack构建)的项目整合进行介绍,对于ssm和vue单独项目的搭建不作为本文 ...
- 若依前后端分离版怎样去掉登录验证码
场景 若依前后端分离版手把手教你本地搭建环境并运行项目: 若依前后端分离版手把手教你本地搭建环境并运行项目_BADAO_LIUMANG_QIZHI的博客-CSDN博客_若依前后端分离版本的配置 上面在 ...
- 若依前后端分离版数据库已经存在的字典添加一条后刷新没作用,必须清除Redis缓存
场景 使用若依的前后端分离版,前端下拉框的使用直接查询的是字典表中的数据. 对于某个类型的字典如果之前已经添加过并使用过,后来想要再添加一条此类型的字典. 在数据库中添加后,前端刷新下,发现没有获取到 ...
- 若依前后端分离版怎样根据数据库生成代码并快速实现某业务的增删改查
场景 使用若依的前后端分离版,怎样使用其代码生成实现对单表的增删改查导出的业务. 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程 ...
- 若依前后端分离版怎样修改主页面和浏览器上的图标和标题
场景 使用若依的前后端分离版,,其默认的图标和标题等如下 如果想要修改为自己想要的标题和图标,实现类似下面的效果 注: 博客: https://blog.csdn.net/badao_liumang_ ...
- 若依管理系统前后端分离版基于ElementUI和SpringBoot怎样实现Excel导入和导出
场景 使用若依前后端分离版实现Excel的导入和导出. 前端:Vue+ElementUI 后端:SpringBoot+POI+Mysql 注: 博客: https://blog.csdn.net/ba ...
最新文章
- JavaScript--正则
- 网页学名为html文件,什么是HTML
- codeforce 603B - Moodular Arithmetic
- 经典C语言程序100例之三九
- java set第n位_Java学习路线:float在内存中的存储
- PDU (Protocol Data Unit) - 协议数据单元
- 云服务器安全组配置(阿里云,ucloud云,华为云)
- 蓝桥杯 ALGO-87 算法训练 字串统计
- 浅谈分辨率对模型影响以及训练方法
- 网络安全联盟推进威胁情报共享的扩张
- python小玩意——计算器
- 学习微积分60年有感(III)
- 2017-2021年 ISSCC/IEDM/VLSI三大会论文库信息提取与统计的工作流
- 打印容器_化妆品公司购买3D打印机能干什么?
- 2020 蓝桥杯大学模拟赛(三) - 程序设计:养猫题解
- android 微信跨境支付,微信跨境支付已在超过49个境外国家和地区合规接入
- OpenShift 4 - 用 External Secret 集成 Hashicorp Vault
- HTTPS接口压测 --- hey工具
- 为什么说单页面程序SEO不友好?
- 分享几个Wordpress模板下载网站
热门文章
- 假如程序员进军UI界
- 米思齐(Mixly)图形化系列教程(五)-if……else……与逻辑运算
- 众数、极差、四分位差、方差、标准差、离散系数 Python求解
- 创业项目-互联网全媒体广告
- Exchange-重建见证服务器和目录
- 百度贴吧营销实战之推广入口布局技巧
- UIButton和UIImageView的圆角用CornerRadius和BezierPath实现对比
- cocos2dx uv动画溢出_宝爷Debug小记——Cocos2d-x(3.13之前的版本)底层BUG导致Spine渲染花屏...
- 逻辑器件功耗计算——CMOS的静态功耗与动态功耗
- Android手机底部NavigationBar挡住界面的解决方法