Skip to content
This repository has been archived by the owner on Aug 18, 2019. It is now read-only.

Commit

Permalink
support query by user name
Browse files Browse the repository at this point in the history
  • Loading branch information
xcorpio committed Jun 24, 2018
1 parent 49e16b8 commit a38e335
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/cc/akkaha/shop/controllers/ShopOrderController.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ public Object query(@RequestBody QueryShopOrder query) {
if (null != query.getStatus()) {
userOrderWrapper.eq(ShopOrder.STATUS, query.getStatus());
}
if (StringUtils.isNotEmpty(query.getUserName())) {
EntityWrapper<ShopUser> userEntityWrapper = new EntityWrapper<>();
userEntityWrapper.like(ShopUser.NAME, query.getUserName());
List<Integer> userIds = shopUserService.selectList(userEntityWrapper)
.stream()
.map(ShopUser::getId)
.collect(Collectors.toList());
if (null != userIds && !userIds.isEmpty()) {
userOrderWrapper.in(ShopOrder.USER, userIds);
}
}
Date start = null;
Date end = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class QueryShopOrder extends ShopOrder {
private Integer size = 10;
private String start;
private String end;
private String userName;

public Integer getCurrent() {
if (null == this.current) {
Expand Down Expand Up @@ -40,4 +41,12 @@ public String getEnd() {
public void setEnd(String end) {
this.end = end;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}
}

0 comments on commit a38e335

Please sign in to comment.