new
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#jpa
|
||||
### 查询条件
|
||||
使用Persist Object存查询条件
|
||||
```java
|
||||
QuestInfoPO po = new QuestInfoPO();
|
||||
po.setCreatorId(StringUtils.isBlank(creatorId) ? null : creatorId);
|
||||
po.setCreatedBy(StringUtils.isBlank(creatorName) ? null : creatorName);
|
||||
po.setName(StringUtils.isBlank(questName) ? null : questName);
|
||||
po.setStatus(status);
|
||||
```
|
||||
### 过滤规则
|
||||
使用ExampleMatch指定过滤规则,matcher的properties使用的是表字段名
|
||||
```java
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withMatcher("creator_id", match -> match.exact())
|
||||
.withMatcher("created_by", match -> match.contains())
|
||||
.withMatcher("name", match -> match.contains())
|
||||
.withMatcher("status", match -> match.exact())
|
||||
.withIgnoreNullValues();
|
||||
```
|
||||
### 排除空条件
|
||||
使用withIgnoreNullValues()排除po中的null条件
|
||||
Reference in New Issue
Block a user