接上篇:Mybatis环境搭建 在搭建环境时已经有了mapper和sqlMapConfig 1,数据库建表 prompt PL/SQL Developer import file prompt Created on 2018年6月1日 by Administrator set feedback off set define off prompt Creating T_USER... create table T_USER ( T_NAME ) not null, T_PASS ), T_ID )…
项目中使用springboot+mybatis-plus来实现. 但是之前处理的时候都是一个功能,比如分页查询,条件查询,模糊查询. 这次将这个几个功能合起来就有点头疼,写下这边博客来记录自己碰到的问题 我们如果要实现多表分页模糊查询,需要按照下面的步骤进行. 配置分页插件 @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } 请求类和结果返回类 对于多…
模糊查询 测试的时候需要提供百分号的模糊查询.传入的参数提供百分号 所有包含王字的就都查询出来了.…
1.where 条件过滤 常见的表达式过滤:比如: select * from 表 where Id>10; 多条件过滤: and or not    (优先级:not > and > or)       !  &&     || select * from SalesLT.Customer where CustomerID and Title<>'MS.' or MiddleName='N.' --<>非的意思 先运算 <>, 再运算…
T-SQL简单查询语句 简单查询: 1.最简单查询(查所有数据) select * from 表名: 注:* 代表所有列 select * from info 2.查询指定列 select code,name from info 3.修改结果集的列名 select code as '代号',name as '姓名' from info 4.条件查询 select * from info where code='p003' 5.多条件查询 查询info表中code为p003或者nation为n00…
分组查询: https://www.cnblogs.com/netserver/p/4518995.html 日期格式化格式: http://blog.csdn.net/qq_16769857/article/details/52289627 日期和字符串之间的转换: https://www.cnblogs.com/windphoenix/archive/2013/04/26/3044784.html 日期的模糊查询: https://zhidao.baidu.com/question/5071…
1.在mybatis中,书写sql,有时候会有一些不细心,如: <!-- 首页商品 关键字搜索--> <select id="getGoodsByLikeTitle" resultMap="BaseResultMap"> SELECT <!-- 详情 --> gd.pay_price, gd.id, gd.couponamount, gd.sale_point, gd.earn_point, gd.stock_quantity,…
使用mybatis的时候,经常发现一个需求,我怎么知道自己是不是增加/修改/删除数据成功了? 好像执行sql之后都没有结果的.其实不是的,增删改的sql执行之后都会有一个int类型的返回值,表示的意思是这个操作影响的行数.举个例子,如果我们插入一行成功的话,影响的就是一行.如果我们修改一条数据成功的话,那么我们也是影响了一行.如果我们删除一条数据成功的话,那么返回的就是1,表示影响了一行,如果没有删除任何的数据,那么返回值就是0.所以我们经常使用返回值是否大于0来表示是不是修改(增加/更新/删除…
方法:使用concat函数连接通配符…
多参数查询,使用parameterType.实例: 用户User[id, name, age] 1.mysql建表并插入数据 2.Java实体类 public class User { public User() { } public User(int id, String name, int age) { super(); this.id = id; this.name = name; this.age = age; } private int id; private String name;…