|
|
@@ -421,25 +421,6 @@ public class AssetService {
|
|
|
Map<String, Object> query = pageQuery.getQuery();
|
|
|
Page<TokenHistory> page = tokenHistoryRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
List<Predicate> and = JpaUtils.toPredicates(pageQuery, TokenHistory.class, root, criteriaQuery, criteriaBuilder);
|
|
|
- String operation = (String) query.get("operation");
|
|
|
-
|
|
|
- if (ObjectUtils.isNotEmpty(query.get("operation"))){
|
|
|
- if (operation.equals("买入")){
|
|
|
- operation="出售";
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- operation="转让";
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
- operation="空投";
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
- }else if (operation.equals("卖出")){
|
|
|
- operation="转让";
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- }else {
|
|
|
- operation="转赠";
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (ObjectUtils.isEmpty(query.get("toUserId")) && ObjectUtils.isEmpty(query.get("fromUserId"))) {
|
|
|
and.add(criteriaBuilder.or(criteriaBuilder.equal(root.get("toUserId"), userId), criteriaBuilder.equal(root.get("fromUserId"), userId)));
|
|
|
} else {
|
|
|
@@ -448,6 +429,22 @@ public class AssetService {
|
|
|
} else {
|
|
|
and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("fromUserId"), userId)));
|
|
|
}
|
|
|
+ if (ObjectUtils.isNotEmpty(query.get("operation"))){
|
|
|
+ String operation = (String) query.get("operation");
|
|
|
+ switch (operation){
|
|
|
+ case "买入":
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), "出售")));
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), "转让")));
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), "空投")));
|
|
|
+ break;
|
|
|
+ case "卖出":
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), "转让")));
|
|
|
+ break;
|
|
|
+ case "转赠":
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), "转赠")));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|