T - 实体类类型I - 主键类型public class ExampleWrapper<T,I extends Serializable> extends Object
| Constructor and Description |
|---|
ExampleWrapper(BaseMapper<T,I> baseMapper,
Example<T> example) |
| Modifier and Type | Method and Description |
|---|---|
ExampleWrapper<T,I> |
anyCondition(boolean useCondition,
String condition)
添加任意条件,条件一定是后端使用的,需要自己防止 SQL 注入
|
ExampleWrapper<T,I> |
anyCondition(boolean useCondition,
String condition,
Object value)
手写左边条件,右边用value值
|
ExampleWrapper<T,I> |
anyCondition(boolean useCondition,
String condition,
Supplier<Object> supplier)
手写左边条件,右边用value值
|
ExampleWrapper<T,I> |
anyCondition(String condition)
添加任意条件,条件一定是后端使用的,需要自己防止 SQL 注入
|
ExampleWrapper<T,I> |
anyCondition(String condition,
Object value)
手写左边条件,右边用value值
|
ExampleWrapper<T,I> |
between(boolean useCondition,
Fn<T,Object> fn,
Object value1,
Object value2)
字段 between value1 and value 2
|
ExampleWrapper<T,I> |
between(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier1,
Supplier<Object> supplier2)
字段 between value1 and value 2
|
ExampleWrapper<T,I> |
between(Fn<T,Object> fn,
Object value1,
Object value2)
字段 between value1 and value 2
|
ExampleWrapper<T,I> |
clear()
清除条件,可重用
|
ExampleWrapper<T,I> |
contains(boolean useCondition,
Fn<T,Object> fn,
String value)
字段 like %值%
|
ExampleWrapper<T,I> |
contains(boolean useCondition,
Fn<T,Object> fn,
Supplier<String> supplier)
字段 like %值%
|
ExampleWrapper<T,I> |
contains(Fn<T,Object> fn,
String value)
字段 like %值%
|
long |
count()
查询符合当前条件的结果数
|
int |
delete()
根据当前条件删除
|
ExampleWrapper<T,I> |
distinct()
设置 distince
|
ExampleWrapper<T,I> |
endSql(String endSql)
设置结尾 SQL
|
ExampleWrapper<T,I> |
endsWith(boolean useCondition,
Fn<T,Object> fn,
String value)
字段 like %值,匹配 value 为后缀的值
|
ExampleWrapper<T,I> |
endsWith(boolean useCondition,
Fn<T,Object> fn,
Supplier<String> supplier)
字段 like %值,匹配 value 为后缀的值
|
ExampleWrapper<T,I> |
endsWith(Fn<T,Object> fn,
String value)
字段 like %值,匹配 value 为后缀的值
|
ExampleWrapper<T,I> |
eq(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 = 值
|
ExampleWrapper<T,I> |
eq(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 = 值
|
ExampleWrapper<T,I> |
eq(Fn<T,Object> fn,
Object value)
字段 = 值
|
Example<T> |
example()
获取查询条件
|
ExampleWrapper<T,I> |
exclude(Fn<T,Object>... fns)
排除指定查询列
|
Optional<T> |
first()
根据当前查询条件查询出第一个结果,通过
RowBounds 实现 |
ExampleWrapper<T,I> |
ge(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 >= 值
|
ExampleWrapper<T,I> |
ge(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 >= 值
|
ExampleWrapper<T,I> |
ge(Fn<T,Object> fn,
Object value)
字段 >= 值
|
ExampleWrapper<T,I> |
gt(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 > 值
|
ExampleWrapper<T,I> |
gt(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 > 值
|
ExampleWrapper<T,I> |
gt(Fn<T,Object> fn,
Object value)
字段 > 值
|
ExampleWrapper<T,I> |
in(boolean useCondition,
Fn<T,Object> fn,
Iterable values)
字段 in (值集合)
|
ExampleWrapper<T,I> |
in(boolean useCondition,
Fn<T,Object> fn,
Supplier<Iterable> supplier)
字段 in (值集合)
|
ExampleWrapper<T,I> |
in(Fn<T,Object> fn,
Iterable values)
字段 in (值集合)
|
ExampleWrapper<T,I> |
isNotNull(boolean useCondition,
Fn<T,Object> fn)
指定字段不为 null
|
ExampleWrapper<T,I> |
isNotNull(Fn<T,Object> fn)
指定字段不为 null
|
ExampleWrapper<T,I> |
isNull(boolean useCondition,
Fn<T,Object> fn)
指定字段为 null
|
ExampleWrapper<T,I> |
isNull(Fn<T,Object> fn)
指定字段为 null
|
ExampleWrapper<T,I> |
le(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 <= 值
|
ExampleWrapper<T,I> |
le(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 <= 值
|
ExampleWrapper<T,I> |
le(Fn<T,Object> fn,
Object value)
字段 <= 值
|
ExampleWrapper<T,I> |
like(boolean useCondition,
Fn<T,Object> fn,
String value)
字段 like 值
|
ExampleWrapper<T,I> |
like(boolean useCondition,
Fn<T,Object> fn,
Supplier<String> supplier)
字段 like 值
|
ExampleWrapper<T,I> |
like(Fn<T,Object> fn,
String value)
字段 like 值
|
List<T> |
list()
根据当前查询条件查询
|
ExampleWrapper<T,I> |
lt(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 < 值
|
ExampleWrapper<T,I> |
lt(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 < 值
|
ExampleWrapper<T,I> |
lt(Fn<T,Object> fn,
Object value)
字段 < 值
|
ExampleWrapper<T,I> |
ne(boolean useCondition,
Fn<T,Object> fn,
Object value)
字段 != 值
|
ExampleWrapper<T,I> |
ne(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier)
字段 != 值
|
ExampleWrapper<T,I> |
ne(Fn<T,Object> fn,
Object value)
字段 != 值
|
ExampleWrapper<T,I> |
notBetween(boolean useCondition,
Fn<T,Object> fn,
Object value1,
Object value2)
字段 not between value1 and value 2
|
ExampleWrapper<T,I> |
notBetween(boolean useCondition,
Fn<T,Object> fn,
Supplier<Object> supplier1,
Supplier<Object> supplier2)
字段 not between value1 and value 2
|
ExampleWrapper<T,I> |
notBetween(Fn<T,Object> fn,
Object value1,
Object value2)
字段 not between value1 and value 2
|
ExampleWrapper<T,I> |
notIn(boolean useCondition,
Fn<T,Object> fn,
Iterable values)
字段 not in (值集合)
|
ExampleWrapper<T,I> |
notIn(boolean useCondition,
Fn<T,Object> fn,
Supplier<Iterable> supplier)
字段 not in (值集合)
|
ExampleWrapper<T,I> |
notIn(Fn<T,Object> fn,
Iterable values)
字段 not in (值集合)
|
ExampleWrapper<T,I> |
notLike(boolean useCondition,
Fn<T,Object> fn,
String value)
字段 not like 值
|
ExampleWrapper<T,I> |
notLike(boolean useCondition,
Fn<T,Object> fn,
Supplier<String> supplier)
字段 not like 值
|
ExampleWrapper<T,I> |
notLike(Fn<T,Object> fn,
String value)
字段 not like 值
|
Optional<T> |
one()
根据当前查询条件查询出一个结果,当存在多个符合条件的结果时会抛出异常
TooManyResultsException |
ExampleWrapper<T,I> |
or()
or 一组条件
|
ExampleWrapper<T,I> |
or(Function<Example.OrCriteria<T>,Example.OrCriteria<T>>... orParts)
嵌套 or 查询,数组多个条件直接使用 or,单个条件中为 and
|
ExampleWrapper<T,I> |
orderBy(boolean useOrderBy,
Supplier<String> orderByCondition)
支持使用字符串形式来设置 order by,用以支持一些特殊的排序方案
|
ExampleWrapper<T,I> |
orderBy(Fn<T,Object> fn,
Example.Order order)
通过方法引用方式设置排序字段
|
ExampleWrapper<T,I> |
orderBy(String orderByCondition)
支持使用字符串形式来设置 order by,用以支持一些特殊的排序方案
|
ExampleWrapper<T,I> |
orderBy(Supplier<String> orderByCondition)
支持使用字符串形式来设置 order by,用以支持一些特殊的排序方案
|
ExampleWrapper<T,I> |
orderByAsc(Fn<T,Object>... fns)
通过方法引用方式设置排序字段,升序排序
|
ExampleWrapper<T,I> |
orderByDesc(Fn<T,Object>... fns)
通过方法引用方式设置排序字段,降序排序
|
ExampleWrapper<T,I> |
select(Fn<T,Object>... fns)
指定查询列
|
ExampleWrapper<T,I> |
set(boolean useSet,
Fn<T,Object> fn,
Object value)
设置更新字段和值
|
ExampleWrapper<T,I> |
set(boolean useSet,
Fn<T,Object> fn,
Supplier<Object> supplier)
设置更新字段和值
|
ExampleWrapper<T,I> |
set(boolean useSet,
String setSql)
设置更新字段和值
|
ExampleWrapper<T,I> |
set(Fn<T,Object> fn,
Object value)
设置更新字段和值
|
ExampleWrapper<T,I> |
set(String setSql)
设置更新字段和值
|
ExampleWrapper<T,I> |
startSql(String startSql)
设置起始 SQL
|
ExampleWrapper<T,I> |
startsWith(boolean useCondition,
Fn<T,Object> fn,
String value)
字段 like 值%,匹配 value 为前缀的值
|
ExampleWrapper<T,I> |
startsWith(boolean useCondition,
Fn<T,Object> fn,
Supplier<String> supplier)
字段 like 值%,匹配 value 为前缀的值
|
ExampleWrapper<T,I> |
startsWith(Fn<T,Object> fn,
String value)
字段 like 值%,匹配 value 为前缀的值
|
Stream<T> |
stream()
根据当前查询条件查询,返回 Stream
|
List<T> |
top(int n)
根据当前查询条件查询出前 n 个结果,通过
RowBounds 实现 |
int |
update()
将符合当前查询条件的数据更新为
set(String) 和 set(Fn, Object) 设置的值 |
int |
update(T t)
将符合当前查询条件的数据更新为提供的值,
set(String) 和 set(Fn, Object) 设置的值无效 |
int |
updateSelective(T t)
将符合当前查询条件的数据更新为提供的值,不更新 null 的值
|
public ExampleWrapper(BaseMapper<T,I> baseMapper, Example<T> example)
public ExampleWrapper<T,I> or()
public ExampleWrapper<T,I> clear()
@SafeVarargs public final ExampleWrapper<T,I> select(Fn<T,Object>... fns)
fns - 方法引用@SafeVarargs public final ExampleWrapper<T,I> exclude(Fn<T,Object>... fns)
fns - 方法引用public ExampleWrapper<T,I> startSql(String startSql)
startSql - 起始 SQL,添加到 SQL 前,注意防止 SQL 注入public ExampleWrapper<T,I> endSql(String endSql)
endSql - 结尾 SQL,添加到 SQL 最后,注意防止 SQL 注入public ExampleWrapper<T,I> orderBy(Fn<T,Object> fn, Example.Order order)
fn - 排序列的方法引用order - 排序方式public ExampleWrapper<T,I> orderBy(String orderByCondition)
orderByCondition - 排序字符串(不会覆盖已有的排序内容)public ExampleWrapper<T,I> orderBy(Supplier<String> orderByCondition)
orderByCondition - 排序字符串构造方法,比如通过数组集合循环拼接等public ExampleWrapper<T,I> orderBy(boolean useOrderBy, Supplier<String> orderByCondition)
useOrderBy - 条件表达式,true使用,false不使用 字符串排序orderByCondition - 排序字符串构造方法,比如通过数组集合循环拼接等@SafeVarargs public final ExampleWrapper<T,I> orderByAsc(Fn<T,Object>... fns)
fns - 排序列的方法引用@SafeVarargs public final ExampleWrapper<T,I> orderByDesc(Fn<T,Object>... fns)
fns - 排序列的方法引用public ExampleWrapper<T,I> distinct()
public ExampleWrapper<T,I> set(boolean useSet, String setSql)
useSet - 表达式条件, true 使用,false 不使用setSql - "column = value"public ExampleWrapper<T,I> set(String setSql)
setSql - "column = value"public ExampleWrapper<T,I> set(boolean useSet, Fn<T,Object> fn, Object value)
useSet - 表达式条件, true 使用,false 不使用fn - 字段value - 值public ExampleWrapper<T,I> set(boolean useSet, Fn<T,Object> fn, Supplier<Object> supplier)
useSet - 表达式条件, true 使用,false 不使用fn - 字段supplier - 值构造函数public ExampleWrapper<T,I> set(Fn<T,Object> fn, Object value)
fn - 字段value - 值public ExampleWrapper<T,I> isNull(boolean useCondition, Fn<T,Object> fn)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用public ExampleWrapper<T,I> isNull(Fn<T,Object> fn)
fn - 字段对应的 get 方法引用public ExampleWrapper<T,I> isNotNull(boolean useCondition, Fn<T,Object> fn)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用public ExampleWrapper<T,I> isNotNull(Fn<T,Object> fn)
fn - 字段对应的 get 方法引用public ExampleWrapper<T,I> eq(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> eq(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数public ExampleWrapper<T,I> eq(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> ne(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数public ExampleWrapper<T,I> ne(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> ne(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> gt(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数public ExampleWrapper<T,I> gt(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> gt(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> ge(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数public ExampleWrapper<T,I> ge(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> ge(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> lt(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用public ExampleWrapper<T,I> lt(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> lt(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> le(boolean useCondition, Fn<T,Object> fn, Object value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> le(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数public ExampleWrapper<T,I> le(Fn<T,Object> fn, Object value)
fn - 字段对应的 get 方法引用value - 值public ExampleWrapper<T,I> in(boolean useCondition, Fn<T,Object> fn, Iterable values)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用values - 值集合public ExampleWrapper<T,I> in(boolean useCondition, Fn<T,Object> fn, Supplier<Iterable> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值集合构造函数public ExampleWrapper<T,I> in(Fn<T,Object> fn, Iterable values)
fn - 字段对应的 get 方法引用values - 值集合public ExampleWrapper<T,I> notIn(boolean useCondition, Fn<T,Object> fn, Iterable values)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用values - 值集合public ExampleWrapper<T,I> notIn(boolean useCondition, Fn<T,Object> fn, Supplier<Iterable> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值集合构造函数public ExampleWrapper<T,I> notIn(Fn<T,Object> fn, Iterable values)
fn - 字段对应的 get 方法引用values - 值集合public ExampleWrapper<T,I> between(boolean useCondition, Fn<T,Object> fn, Object value1, Object value2)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value1 - 值1value2 - 值2public ExampleWrapper<T,I> between(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier1, Supplier<Object> supplier2)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier1 - 值1构造函数supplier2 - 值2构造函数public ExampleWrapper<T,I> between(Fn<T,Object> fn, Object value1, Object value2)
fn - 字段对应的 get 方法引用value1 - 值1value2 - 值2public ExampleWrapper<T,I> notBetween(boolean useCondition, Fn<T,Object> fn, Object value1, Object value2)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value1 - 值1value2 - 值2public ExampleWrapper<T,I> notBetween(boolean useCondition, Fn<T,Object> fn, Supplier<Object> supplier1, Supplier<Object> supplier2)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier1 - 值1构造函数supplier2 - 值2构造函数public ExampleWrapper<T,I> notBetween(Fn<T,Object> fn, Object value1, Object value2)
fn - 字段对应的 get 方法引用value1 - 值1value2 - 值2public ExampleWrapper<T,I> contains(boolean useCondition, Fn<T,Object> fn, String value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值,两侧自动添加 %public ExampleWrapper<T,I> contains(boolean useCondition, Fn<T,Object> fn, Supplier<String> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数,两侧自动添加 %public ExampleWrapper<T,I> contains(Fn<T,Object> fn, String value)
fn - 字段对应的 get 方法引用value - 值,两侧自动添加 %public ExampleWrapper<T,I> startsWith(boolean useCondition, Fn<T,Object> fn, String value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值,右侧自动添加 %public ExampleWrapper<T,I> startsWith(boolean useCondition, Fn<T,Object> fn, Supplier<String> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数,右侧自动添加 %public ExampleWrapper<T,I> startsWith(Fn<T,Object> fn, String value)
fn - 字段对应的 get 方法引用value - 值,右侧自动添加 %public ExampleWrapper<T,I> endsWith(boolean useCondition, Fn<T,Object> fn, String value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值,左侧自动添加 %public ExampleWrapper<T,I> endsWith(boolean useCondition, Fn<T,Object> fn, Supplier<String> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数,左侧自动添加 %public ExampleWrapper<T,I> endsWith(Fn<T,Object> fn, String value)
fn - 字段对应的 get 方法引用value - 值,左侧自动添加 %public ExampleWrapper<T,I> like(boolean useCondition, Fn<T,Object> fn, String value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值,需要指定 '%'(多个), '_'(单个) 模糊匹配public ExampleWrapper<T,I> like(boolean useCondition, Fn<T,Object> fn, Supplier<String> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数,需要指定 '%'(多个), '_'(单个) 模糊匹配public ExampleWrapper<T,I> like(Fn<T,Object> fn, String value)
fn - 字段对应的 get 方法引用value - 值,需要指定 '%'(多个), '_'(单个) 模糊匹配public ExampleWrapper<T,I> notLike(boolean useCondition, Fn<T,Object> fn, String value)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用value - 值,需要指定 % 模糊匹配public ExampleWrapper<T,I> notLike(boolean useCondition, Fn<T,Object> fn, Supplier<String> supplier)
useCondition - 表达式条件, true 使用,false 不使用fn - 字段对应的 get 方法引用supplier - 值构造函数,需要指定 % 模糊匹配public ExampleWrapper<T,I> notLike(Fn<T,Object> fn, String value)
fn - 字段对应的 get 方法引用value - 值,需要指定 % 模糊匹配public ExampleWrapper<T,I> anyCondition(boolean useCondition, String condition)
useCondition - 表达式条件, true 使用,false 不使用condition - 任意条件,例如 "length(countryname)<5"public ExampleWrapper<T,I> anyCondition(String condition)
condition - 任意条件,例如 "length(countryname)<5"public ExampleWrapper<T,I> anyCondition(boolean useCondition, String condition, Object value)
useCondition - 表达式条件, true 使用,false 不使用condition - 例如 "length(countryname)="value - 例如 5public ExampleWrapper<T,I> anyCondition(boolean useCondition, String condition, Supplier<Object> supplier)
useCondition - 表达式条件, true 使用,false 不使用condition - 例如 "length(countryname)="supplier - 任意条件值的构造函数public ExampleWrapper<T,I> anyCondition(String condition, Object value)
condition - 例如 "length(countryname)="value - 例如 5@SafeVarargs public final ExampleWrapper<T,I> or(Function<Example.OrCriteria<T>,Example.OrCriteria<T>>... orParts)
orParts - 条件块public int delete()
public int update()
set(String) 和 set(Fn, Object) 设置的值public int update(T t)
set(String) 和 set(Fn, Object) 设置的值无效t - 要更新的值public int updateSelective(T t)
t - 要更新的值public long count()
Copyright © 2022. All rights reserved.