随笔分类 -  Mybatis

摘要:MySQL数据库,利用concat函数即可,MySQL不用能||连接字符串 mapper.xml select * from tb_content_category where title like concat('%',#{paramMap.TITLE, jdbcType=VARCHAR},'%' 阅读全文
posted @ 2020-04-13 10:08 AlphaJunS 阅读(834) 评论(0) 推荐(0) 编辑
摘要:该工具类使用mybatis的会话来手动提交事务,从而对批量sql进行控制。事务提交,多条sql执行结果会被更新到数据库,出现异常则回滚。 测试采用的表为oracle数据库scott下的dept表和salgrade表 MyBatisBatchHelper.java package com.alphaj 阅读全文
posted @ 2020-04-04 10:50 AlphaJunS 阅读(704) 评论(0) 推荐(0) 编辑
摘要:PageHelper分页的实现利用了自定义拦截器实现了Mybatis拦截器接口。 1、pom.xml中引入pageHelper分页jar包 <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper --> <de 阅读全文
posted @ 2020-04-03 22:01 AlphaJunS 阅读(888) 评论(2) 推荐(0) 编辑
摘要:以Oracle数据库Scott用户下的emp表举例,其中参数为List<Map<String, Integer>>时mapper.xml的写法需要注意,Oracle与MySQL不同 MySQL: <update id="updateEmpByMapList" parameterType="list" 阅读全文
posted @ 2020-03-30 21:59 AlphaJunS 阅读(3345) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示