mybatis
文章平均质量分 68
mybatis
执于代码
通信金融互联网行业,开发工程师:
所有Blog 如下:
https://github.com/xiamaocheng
展开
-
mybatis 传递参数的三种方式
mybatis 传递参数的方式主要有三种:1.多个参数的传递方式GoodMapper.java:public Good selectGood(String id, String name);GoodMapper.xml :<select id="selectGood" resultMap="GoodMap"> se...原创 2019-10-16 19:07:36 · 335 阅读 · 0 评论 -
Mybatis,其中难点问题做了详细解释
例如,在一些动态表格(根据不同的条件产生不同的动态列)中,我们要传递SQL的列名,根据某些列进行排序,或者传递列名给SQL都是比较常见的场景,这就无法使用预编译的方式了。其中,分页插件的原理是,拦截查询SQL,在这个SQL基础上自动为其添加limit分页条件。若 字段名 (数据库里的名字例如emp_name)和 实体类中的属性名 不一致,但是字段名符合数据库的规则(使用 _ ),实体类中的属性 名符合Java的规则(使用驼峰),此时也可通过以下两种方式处理字段名和实体类中的属性的映射关系。...原创 2022-08-29 16:24:39 · 267 阅读 · 0 评论 -
动态SQL_Mybatis的if和where 的使用
拼SQL的方法:1.if -and 标签if 可以对vo 标签的进行数值判断,拼凑SQL。这里我们可以使用规则的数据结构来存储和转发。在mybatis的动态sql语句中使用标签可以判断sql中的条件是否成立。在上面的动态sql语句中存在一个问题,当第一条sql判断语句where后面多一个and,执行sql时会失败:在where条件后面加了一条判断1=1,然后在id的判断后加上and关键字,这样当下面if条件中的任何一个判断失败后,都不会影响整个sql语句。where条件的最后多一个and,sql语句执原创 2022-07-21 23:01:40 · 1098 阅读 · 0 评论 -
mybati sql 语句打印
1:首先将ibatis log4j运行级别调到DEBUG可以在控制台打印出ibatis运行的sql语句###显示SQL语句部分log4j.logger.com.ibatis=DEBUGlog4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUGlog4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUGlog4j.logger.com.ibatis.sqlmap.engine.impl.SqlM原创 2022-06-30 08:00:39 · 1114 阅读 · 0 评论 -
Mybatis的引入问题invalid
出现了invalid statement主要检查3点:一。引入POM文件二。加配置文件,三。程序中扫描包看检测一下命名空间问题按照解决的方案来原创 2022-06-23 08:25:31 · 142 阅读 · 0 评论 -
myibtis 入门:
1.官网2.配置demo:<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"&...原创 2019-07-18 20:06:07 · 176 阅读 · 0 评论 -
Mybatis 源码学习type 包
Mybatis 源码学习type 包目录概 述类型处理器类型注册表TypeHandlerRegistry小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay aw原创 2022-05-13 12:20:27 · 227 阅读 · 0 评论 -
【mybatis-session包】
mybatis-session包目录概 述小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is ch原创 2022-05-13 11:30:30 · 259 阅读 · 0 评论 -
mybatis script-脚本解析
mybatis 之脚本解析:测试代码:@Test void setParametersThrowsProperException() throws SQLException { final MappedStatement mappedStatement = getMappedStatement(); final Object parameterObject = null; final BoundSql boundSql = mock(BoundSql.class);原创 2022-05-12 11:55:59 · 419 阅读 · 0 评论 -
mybatis-反射-reflection
mybatis io 机制目录概 述小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is cheap原创 2022-05-11 14:23:13 · 173 阅读 · 0 评论 -
mybatis io 机制
mybatis io 机制目录概 述小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is cheap原创 2022-05-11 13:18:24 · 178 阅读 · 0 评论 -
Mybatis 数据源
beanFactoryPostProcess目录概 述小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk原创 2022-05-10 15:29:08 · 1556 阅读 · 0 评论 -
mybatis build下的xml 解析
1.在mybatis中如何获取的对应的sql的方法?测试代码: @Test void testShrinkWhitespacesInSqlIsFalse() { SqlSource sqlSource = sqlSourceBuilder.parse(sqlFromXml, null, null); BoundSql boundSql = sqlSource.getBoundSql(null); String actual = boundSql.getSql();原创 2022-05-10 15:05:14 · 199 阅读 · 0 评论 -
浅谈my batis 下的Bind
mybatis 的Binding 测试如下:测试代码: @Test void shouldExecuteBoundSelectMapOfBlogsById() { try (SqlSession session = sqlSessionFactory.openSession()) { BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class); Map<Integer,Blog> bl原创 2022-05-08 19:47:23 · 402 阅读 · 0 评论 -
Mybatis Annoted对象的使用
1.写一个annotationt 对象:public class AnnotatedSubject { private final int id; private final String name; private final int age; private final int height; private final int weight;//省略set 和get方法2.写一个接口文件:public interface AutoConstructorMapper {原创 2022-05-08 08:17:33 · 136 阅读 · 0 评论 -
mybatis映射mappring
我们做下测试:源码如下: List<ParameterMapping> params = Collections.emptyList(); BoundSql boundSql = new BoundSql(new Configuration(), "some sql", params, new Object()); Map<String, String> map = new HashMap<>(); map.put("key1", "val原创 2022-05-07 23:47:59 · 402 阅读 · 0 评论 -
浅谈mybatis的executor
executor 作为mybatis 的执行组件,是Mybatis 的组件之一。将执行数据库的操作的。基本的executor的测试:一。基本处理我们做个测试://创建executor 对象Executor executor = createExecutor(new JdbcTransaction(ds, null, false));//mappedStatement 对象 try { Author author = new Author(-1, "someone", "*原创 2022-05-07 14:04:15 · 702 阅读 · 0 评论 -
mybatis plugs 插件和原理简介
目录前言如下我们将了解一下Mybatis的插件的用法:Mybatis插件(plugin)顾名思义就是在Mybatis基础上做的集成软件。主要步骤:1.写一个实现Interceptor的方法,并且复写intercept方法2.根据功能写函数实现,3.测试插件公共功能代码实现假如我们直接想做出一个直接输出字符串的功能,那么我们如何写呢?如下:按照前文所述,第一步实现Interceptor的接口:public static class AlwaysMapPlugin implements原创 2022-05-04 10:02:19 · 366 阅读 · 0 评论 -
mybatis includes 用法
mybatisforeach 等测试目录概 述测试问题:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.tal原创 2022-04-20 17:11:02 · 735 阅读 · 0 评论 -
mybatisforeach 等测试
mybatis的事务管理目录概 述测试问题:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is c原创 2022-04-20 16:46:41 · 431 阅读 · 0 评论 -
mybatis的事务管理
mybatis的事务管理目录概 述测试问题:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is c原创 2022-04-19 18:23:07 · 533 阅读 · 0 评论 -
谈一下mybatis 的缓存
mybatis 的缓存目录概 述测试问题:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is ch原创 2022-04-17 17:48:09 · 88 阅读 · 0 评论 -
几个Mybatis 测试问题
几个Mybatis 测试问题目录概 述测试问题:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is原创 2022-04-11 18:53:56 · 788 阅读 · 0 评论 -
spring源码学习之整合Mybatis原理分析
MyBatis与Spring整合后如何保证SqlSession线程安全目录概述小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor原创 2022-01-20 20:30:11 · 195 阅读 · 0 评论 -
MyBatis与Spring整合后如何保证SqlSession线程安全
MyBatis与Spring整合后如何保证SqlSession线程安全目录概述小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor原创 2022-01-20 20:10:56 · 4298 阅读 · 1 评论 -
Mybatis构建模式
Mybatis构建模式目录概述小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is cheap,原创 2022-01-08 11:29:47 · 75 阅读 · 0 评论 -
Mybatis的工厂模式的使用
Mybatis源码分析目录概述小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is cheap,原创 2022-01-08 11:02:36 · 452 阅读 · 0 评论 -
MyBatis源码分析-SQL语句执行的完整流程
Mybatis源码分析目录概述执行sql语句源码分析:操作数据库源码分析:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poo原创 2022-01-07 19:20:50 · 118 阅读 · 0 评论 -
mybatis源码分析_数据库源码分析
Mybatis源码分析目录概述实现思路分析1.Mybatis的源码分析:执行sql语句源码分析:操作数据库源码分析:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, a原创 2022-01-07 19:04:19 · 1170 阅读 · 0 评论 -
前后台分页参数用法
前后台分页参数用法目录概 述如何操作:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is chea原创 2021-11-12 11:54:04 · 450 阅读 · 0 评论 -
mybatis sql 代码复用
(十一)Activitivi5之流程控制网关:连线目录概 述配置:小结参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people原创 2021-11-11 21:25:13 · 1089 阅读 · 0 评论 -
关于mybatis对应的小对象VO向大对象vo 转化的问题:
项目场景:问题描述:一开始我的对应的vo 并没有找到,出现了查询出来记录但是查不到数据的情况,最后排查是映射问题。在type 字段上映射VO问题,一开始我向的是一对一映射,后来用了小对象向大对象转化的问题:结果证明是可行的,此时会将对应的属性进行填充。应为是是service 调用的,所以变成了对应的bean实体,结果证明时候可以的。即映射到高对象的属性,向下拆是可以的。 原因分析:解决方案:...原创 2021-11-11 21:06:49 · 136 阅读 · 0 评论 -
三表权限的问题设计
(三表权限目录概 述配置::小结参考LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.talk is cheap, show othe原创 2021-11-09 22:19:06 · 134 阅读 · 0 评论 -
mybatis 模糊查询的机种写法
Activiti工作流引擎使用详解(一)目录概 述配置文件第一种(1)使用${...}第二种第三种:(3)使用CONCAT()函数连接参数形式总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, s原创 2021-10-23 23:09:32 · 58 阅读 · 0 评论 -
mybatis中使用到的设计模式_构造者模式
mybatis中使用到的设计模式_构造者模式目录概 述构造者模式:总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away fr原创 2021-09-01 23:51:05 · 78 阅读 · 0 评论 -
mybatis resultType和resultMap的区别
项目场景:关联映射的时候,返回一个实体好办,但是返回一个自定义对象呢问题描述:CContailder";value 的错误 原因分析:2、resulttype:resultType使用resultType进行输出映射,只有查询出来的列名和pojo中的属性名一致,该列才可以映射成功。第一个单词小写,下划线的单词换成驼峰标示。3.parameter not found 这个参数是因为:mapper 文件和参数传送的不对解决方案:从接口使用传递相同参数即可。将resultM原创 2021-09-30 22:12:51 · 71 阅读 · 0 评论 -
模板方法模式在MyBatis源码中的应用
模板方法模式在MyBatis源码中的应用目录概 述Executor总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away fr原创 2021-09-04 02:24:34 · 190 阅读 · 0 评论 -
mybatis 代理模式简单分析
Mybatis中单列模式应用目录概 述代理模式总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor pe原创 2021-09-02 01:41:31 · 85 阅读 · 0 评论 -
3.mybatis中的责任链
Mybatis中单列模式应用目录概 述单例模式总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor pe原创 2021-09-02 00:00:59 · 447 阅读 · 0 评论 -
MyBatis整合Spring原理分析
MyBatis整合Spring原理分析目录概 述假如不结合Spring框架,我们使用MyBatis时的一个典型使用方式如下:SqlSessionTemplate的源代码,由于源码较多,只贴出重点部分:总结:相关工具如下:分析:小结:参考资料和推荐阅读LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.Modesty is not false, solid is not naive, tre原创 2021-09-01 11:45:43 · 81 阅读 · 0 评论