| 程序包 | 说明 |
|---|---|
| com.baomidou.framework.service |
service 超级抽象类
|
| com.baomidou.framework.service.impl |
service 实现类
|
| com.baomidou.mybatisplus.mapper |
自动处理 CURD 基本 SQL 相关类
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
IService.selectCount(EntityWrapper<T> entityWrapper)
根据 EntityWrapper 条件,查询总记录数
|
List<T> |
IService.selectList(EntityWrapper<T> entityWrapper)
查询列表
|
T |
IService.selectOne(EntityWrapper<T> entityWrapper)
根据 EntityWrapper,查询一条记录
|
Page<T> |
IService.selectPage(Page<T> page,
EntityWrapper<T> entityWrapper)
翻页查询
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
ServiceImpl.selectCount(EntityWrapper<T> entityWrapper) |
List<T> |
ServiceImpl.selectList(EntityWrapper<T> entityWrapper) |
T |
ServiceImpl.selectOne(EntityWrapper<T> entityWrapper) |
Page<T> |
ServiceImpl.selectPage(Page<T> page,
EntityWrapper<T> entityWrapper) |
| 限定符和类型 | 方法和说明 |
|---|---|
EntityWrapper<T> |
EntityWrapper.addFilter(String sqlWhere,
Object... params)
为了兼容之前的版本,可使用where()或and()替代
|
EntityWrapper<T> |
EntityWrapper.addFilterIfNeed(boolean need,
String sqlWhere,
Object... params)
根据判断条件来添加条件语句部分 使用 andIf() 替代
eg: ew.filterIfNeed(false,"name='zhangsan'").where("name='zhangsan'")
.filterIfNeed(true,"id={0}",22)
输出: WHERE (name='zhangsan' AND id=22)
|
EntityWrapper<T> |
EntityWrapper.and(String sqlAnd,
Object... params)
AND 连接后续条件
|
EntityWrapper<T> |
EntityWrapper.andNew(String sqlAnd,
Object... params)
使用AND连接并换行
eg: ew.where("name='zhangsan'").and("id=11").andNew("statu=1"); 输出: WHERE
(name='zhangsan' AND id=11) AND (statu=1)
|
EntityWrapper<T> |
EntityWrapper.between(String column,
String val1,
String val2)
betwwee 条件语句
|
EntityWrapper<T> |
EntityWrapper.exists(String value)
EXISTS 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.groupBy(String columns)
SQL中groupBy关键字跟的条件语句
eg: ew.where("name='zhangsan'").groupBy("id,name")
|
EntityWrapper<T> |
EntityWrapper.having(String sqlHaving,
Object... params)
SQL中having关键字跟的条件语句
eg: ew.groupBy("id,name").having("id={0}",22).and("password is not null")
|
EntityWrapper<T> |
EntityWrapper.in(String column,
List<?> value)
IN 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.in(String column,
Object... value)
IN 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.in(String column,
String value)
IN 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.isNotNull(String columns)
is not null 条件
|
EntityWrapper<T> |
EntityWrapper.isNull(String columns)
is not null 条件
|
EntityWrapper<T> |
EntityWrapper.like(String column,
String value)
LIKE条件语句,value中无需前后% 目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.notExists(String value)
NOT EXISTS条件语句
|
EntityWrapper<T> |
EntityWrapper.notIn(String column,
List<?> value)
NOT IN 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.notIn(String column,
Object... value)
NOT IN 条件语句,目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.notIn(String column,
String value)
NOT IN条件语句
|
EntityWrapper<T> |
EntityWrapper.notLike(String column,
String value)
NOT LIKE条件语句,value中无需前后% 目前适配mysql及oracle
|
EntityWrapper<T> |
EntityWrapper.or(String sqlOr,
Object... params)
添加OR条件
|
EntityWrapper<T> |
EntityWrapper.orderBy(String columns)
SQL中orderby关键字跟的条件语句
eg: ew.groupBy("id,name").having("id={0}",22).and("password is not null"
).orderBy("id,name")
|
EntityWrapper<T> |
EntityWrapper.orderBy(String columns,
boolean isAsc)
SQL中orderby关键字跟的条件语句,可根据变更动态排序
|
EntityWrapper<T> |
EntityWrapper.orNew(String sqlOr,
Object... params)
使用OR换行,并添加一个带()的新的条件
eg: ew.where("name='zhangsan'").and("id=11").orNew("statu=1"); 输出: WHERE
(name='zhangsan' AND id=11) OR (statu=1)
|
EntityWrapper<T> |
EntityWrapper.where(String sqlWhere,
Object... params)
SQL中WHERE关键字跟的条件语句
eg: ew.where("name='zhangsan'").where("id={0}","123");
输出: WHERE (NAME='zhangsan' AND id=123)
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
BaseMapper.selectCountByEw(EntityWrapper<T> entityWrapper)
根据 EntityWrapper 条件,查询总记录数
|
List<T> |
BaseMapper.selectList(EntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录
|
List<T> |
BaseMapper.selectPage(org.apache.ibatis.session.RowBounds rowBounds,
EntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录(并翻页)
|
Copyright © 2016. All rights reserved.