|
|
@@ -422,37 +422,34 @@ public class AssetService {
|
|
|
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.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 {
|
|
|
- if (ObjectUtils.isNotEmpty(query.get("toUserId"))) {
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("toUserId"), userId)));
|
|
|
- } else {
|
|
|
- and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("fromUserId"), userId)));
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if (ObjectUtils.isNotEmpty(query.get("operation"))){
|
|
|
if (operation.equals("买入")){
|
|
|
- log.error("进了买入里了=========");
|
|
|
operation="出售";
|
|
|
- boolean operation1 = and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- log.error("第一次添加========="+operation1);
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
operation="转让";
|
|
|
- boolean operation2 =and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
- log.error("第二次添加========="+operation2);
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
operation="空投";
|
|
|
- boolean operation3 =and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
- log.error("第三次添加========="+operation3);
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"),operation)));
|
|
|
}else if (operation.equals("卖出")){
|
|
|
operation="转让";
|
|
|
- boolean operation1 = and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- log.error("进入卖出========="+operation1);
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
}else {
|
|
|
operation="转赠";
|
|
|
- boolean operation1 = and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("operation"), operation)));
|
|
|
- log.error("进入转赠========="+operation1);
|
|
|
+ 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 {
|
|
|
+ if (ObjectUtils.isNotEmpty(query.get("toUserId"))) {
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("toUserId"), userId)));
|
|
|
+ } else {
|
|
|
+ and.add(criteriaBuilder.and(criteriaBuilder.equal(root.get("fromUserId"), userId)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
}), JpaUtils.toPageRequest(pageQuery));
|
|
|
|