|
|
@@ -791,8 +791,16 @@ public class AssetService {
|
|
|
Set<Tag> tags = mintActivity.getRule().getTags();
|
|
|
if (tags.isEmpty()) return new PageImpl<>(Collections.emptyList());
|
|
|
return assetRepo.findAll((Specification<Asset>) (root, query, criteriaBuilder) ->
|
|
|
- query.distinct(true).where(criteriaBuilder.equal(root.get("userId"), userId),
|
|
|
+ query.distinct(true).where(
|
|
|
+ // where userId=some id
|
|
|
+ criteriaBuilder.equal(root.get("userId"), userId),
|
|
|
+ // and (lockTo is null or (lockTo is not null and lockTo < now))
|
|
|
+ criteriaBuilder.or(criteriaBuilder.isNull(root.get("lockTo")),
|
|
|
+ criteriaBuilder.and(criteriaBuilder.isNotNull(root.get("lockTo")),
|
|
|
+ criteriaBuilder.lessThan(root.get("lockTo"), LocalDateTime.now()))),
|
|
|
+ // and status = 'NORMAL'
|
|
|
criteriaBuilder.equal(root.get("status"), AssetStatus.NORMAL),
|
|
|
+ // and has some tagId
|
|
|
root.join("tags").get("id").in(tags.stream().map(Tag::getId).toArray()))
|
|
|
.getRestriction(), pageable);
|
|
|
} else {
|