|
4 | 4 | import com.codingapi.springboot.framework.dto.request.Filter; |
5 | 5 | import com.codingapi.springboot.framework.dto.request.PageRequest; |
6 | 6 | import com.codingapi.springboot.framework.dto.request.RequestFilter; |
| 7 | +import org.springframework.beans.BeanUtils; |
| 8 | +import org.springframework.data.domain.Example; |
| 9 | + |
7 | 10 | import javax.persistence.criteria.CriteriaBuilder; |
8 | 11 | import javax.persistence.criteria.Order; |
9 | 12 | import javax.persistence.criteria.Predicate; |
10 | 13 | import javax.persistence.criteria.Root; |
11 | | -import org.springframework.beans.BeanUtils; |
12 | | -import org.springframework.data.domain.Example; |
13 | | - |
14 | 14 | import java.beans.PropertyDescriptor; |
15 | 15 | import java.util.ArrayList; |
16 | 16 | import java.util.Date; |
@@ -169,7 +169,10 @@ private <T> Predicate toPredicate(Filter filter, CriteriaBuilder criteriaBuilder |
169 | 169 | Filter[] orFilters = (Filter[]) filter.getValue(); |
170 | 170 | List<Predicate> orPredicates = new ArrayList<>(); |
171 | 171 | for (Filter orFilter : orFilters) { |
172 | | - orPredicates.add(toPredicate(orFilter, criteriaBuilder, root, properties)); |
| 172 | + Predicate predicate = toPredicate(orFilter, criteriaBuilder, root, properties); |
| 173 | + if (predicate != null) { |
| 174 | + orPredicates.add(predicate); |
| 175 | + } |
173 | 176 | } |
174 | 177 | return criteriaBuilder.or(orPredicates.toArray(new Predicate[0])); |
175 | 178 | } |
|
0 commit comments