随笔 - 91,  文章 - 0,  评论 - 3,  阅读 - 47461

随笔分类 -  mybatis相关

mybatis相关学习
SpringBoot+Mybatis-Plus 数据表字段是关键字的问题解决
摘要:如果字段名是关键字,用mybatisplus时会报以下错误: bad SQL grammar []; nested exception is java.sql.BatchUpdateException: ORA-01747: user.table.column, table.column 或列说明无 阅读全文
posted @ 2022-09-27 08:42 飞飞乐园 阅读(792) 评论(0) 推荐(0) 编辑
多数据源配置
摘要:###pom引入依赖 <!-- 动态数据源 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>2.5.4< 阅读全文
posted @ 2021-05-06 09:57 飞飞乐园 阅读(117) 评论(0) 推荐(0) 编辑
mybatis-动态SQL
摘要:#动态SQL 常用元素 if,choose (when, otherwise),trim (where, set),foreach ###if 使用动态 SQL 最常见情景是根据条件包含 where 子句的一部分。比如: <select id="findActiveBlogWithTitleLike 阅读全文
posted @ 2021-03-15 20:21 飞飞乐园 阅读(36) 评论(0) 推荐(0) 编辑
mybatis-xml映射器
摘要:#XML映射器 要使用XML文件需要在pom.xml里面的build中配置映射路径,不然编译后xml到不了classpath中,在springboot中,还需要在启动类或者配置类上加上注解@MapperScan("com.example.springstudy.mapper")//根据项目的mapp 阅读全文
posted @ 2021-03-15 20:19 飞飞乐园 阅读(93) 评论(0) 推荐(0) 编辑
mybatis-plus-条件构造器
摘要:#条件构造器 说明: 以下出现的第一个入参boolean condition表示该条件是否加入最后生成的sql中, g例如:query.like(StringUtils.isNotBlank(name), EntitygetName, name) .eq(age!=null && age >= 0, 阅读全文
posted @ 2021-03-15 20:17 飞飞乐园 阅读(44) 评论(0) 推荐(0) 编辑
mybatis-plus 性能分析插件
摘要:1.MP的性能插件用于输出每条sql以及执行时间。 ①导入插件 @Bean @Profile({"dev","test"})//设置dev test环境开启,保证效率 public PerformanceInterceptor performanceInterceptor(){ Performanc 阅读全文
posted @ 2021-03-09 22:35 飞飞乐园 阅读(83) 评论(0) 推荐(0) 编辑
mybatisplus-分页和查询删除
摘要:1.分页查询 ①配置类中追加分页插件 //注册分页插件 @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } ②测试分页查询 //测试分页查询 @Test 阅读全文
posted @ 2021-03-09 20:56 飞飞乐园 阅读(210) 评论(0) 推荐(0) 编辑
mybatis-plus-乐观锁
摘要:乐观锁:十分乐观。总是认为不会出现问题,无论干什么也不上锁,出了问题再次更新测试。 悲观锁:十分悲观。总是认为会出问题,无论干什么都会上锁,再去操作。 乐观锁实现方式: ·取出记录时,获取当前version ·更新时带上version ·执行更新时,set version=newVersion wh 阅读全文
posted @ 2021-03-04 22:17 飞飞乐园 阅读(39) 评论(0) 推荐(0) 编辑
mybatis-plus-增改,自动填充
摘要:1.主键生成策略 配置主键自增: ①实体类字段加上(@TableId(type=IdType.AUTO)) ②数据库字段一定要自增 其余的源码解释: public enum IdType{ AUTO(0),//自增 NONE(1),//未设置主键 INPUT(2),//手动输入 ID_WORK(3) 阅读全文
posted @ 2021-03-04 21:14 飞飞乐园 阅读(325) 评论(0) 推荐(0) 编辑
第一个mybatisplus
摘要:1.新建Spring Initializr工程。 2.配置pom文件 <!--mysql依赖引入--><dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime< 阅读全文
posted @ 2021-02-28 21:09 飞飞乐园 阅读(125) 评论(0) 推荐(0) 编辑


< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示