
mybatis
一些关于mybatis的使用
fengzelun
这个作者很懒,什么都没留下…
展开
-
mybatis如何高效插入
一、思路 1.java代码分页插入 2.mybatis批量插入 3.如果需要判断“存在则不插入”使用 insert ignore into 替代 select * from dual where not exists 二、ignore和where not exists效率 同等条件下(电脑处理时稍微有些误差),ignore比where not exists快40s ignore执行时间 where not exists执..原创 2021-07-30 18:19:52 · 1232 阅读 · 1 评论 -
MyBatis的statementType标签
作用 标记使用什么对象来操作sql语句 三个参数分别对应三个对象 1.statement,对应Statement 对象: 执行:直接操作sql,不进行预编译,直接获取数据,sql语句中直接使用${}取值2.prepared,对应PreparedStatement对象: 执行:预处理,参数,进行预编译,获取数据,sql语句中直接使用#{}取值 这个参数也是mybatis默认参数3.callable:对应CallableStatemen...原创 2021-06-27 10:19:06 · 431 阅读 · 0 评论 -
mybatis延迟加载
一、什么叫延迟加载 延迟加载,也被称为是嵌套查询,或者懒加载。用于嵌套查询的时候 结合过resultMap标签中的association和collection子标签原创 2021-06-21 00:03:27 · 137 阅读 · 0 评论 -
mybatis批量操作
一、批量插入 <insertid="insertData"parameterType="java.util.List"> insert into t_fee_sourcedata (tag_name,time,data) values <foreachcollection="list"item="item"index="index"separator=","> ( #{item.tag_name}, #{item.time}, #{it原创 2021-06-11 12:37:24 · 1145 阅读 · 2 评论 -
mybatis一对一、一对多
一、一对多 实体类原创 2021-06-20 17:19:35 · 106 阅读 · 0 评论 -
mybatis mapper开发方式-XML
开发方式 只需要开发Mapper接口(dao接口)和Mapper映射文件,不需要编写实现类。 • 开发规范 Mapper接口开发方式需要遵循以下规范: 1、 Mapper接口的类路径与Mapper.xml文件中的namespace相同。 2、 Mapper接口方法名称和Mapper.xml中定义的每个statement的id相同。 3、 Mapper接口方法的输入参数类型和mapper.xml中定义的每个sql 的parameterType的类型相同。 4、 Mapper接口原创 2021-06-16 23:43:20 · 117 阅读 · 0 评论