|
|
@@ -48,6 +48,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.redis.core.BoundSetOperations;
|
|
|
import org.springframework.data.redis.core.BoundValueOperations;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
@@ -55,6 +56,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
+import javax.persistence.criteria.Join;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
@@ -1054,4 +1056,15 @@ public class OrderService {
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ public Page<Order> byTag(Long tagId, List<Long> excludeUserId, Pageable pageable) {
|
|
|
+ if (excludeUserId.isEmpty()) {
|
|
|
+ excludeUserId.add(0L);
|
|
|
+ }
|
|
|
+ return orderRepo.findAll((root, query, criteriaBuilder) -> {
|
|
|
+ Join join = root.join("tags");
|
|
|
+ return criteriaBuilder.and(criteriaBuilder.equal(join.get("id"), tagId),
|
|
|
+ criteriaBuilder.not(root.get("ownerId").in(excludeUserId)));
|
|
|
+ }, pageable);
|
|
|
+ }
|
|
|
}
|