@Override
public List<BillSalesBase> findAllByCondition(String type){
List<BillSalesBase> resultList = null;
Specification querySpecifi = new Specification<BillSalesBase>() {
public Predicate toPredicate(Root<BillSalesBase> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<>();
if(null != type){
predicates.add(criteriaBuilder.like(root.get("bill_type"), "%"+type+"%"));
}
return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
}
};
resultList = billSalesBaseJpa.findAll(querySpecifi);
return resultList;
}
@Override
public Page<PrpsCommisionTaxInfo> findAllByConditions(String businessno,String usercode,String yearmonth,Pageable pageable){
Page<PrpsCommisionTaxInfo> resultList = null;
Specification querySpecifi = new Specification<PrpsCommisionTaxInfo>() {
public Predicate toPredicate(Root<PrpsCommisionTaxInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<>();
if(null != businessno){
predicates.add(criteriaBuilder.like(root.get("businessno"), "%"+businessno+"%"));
}
if(null != usercode){
predicates.add(criteriaBuilder.like(root.get("usercode"), "%"+usercode+"%"));
}
if(null != yearmonth){
predicates.add(criteriaBuilder.like(root.get("yearmonth"), "%"+yearmonth+"%"));
}
return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
}
};
resultList = prpsCommisionTaxInfoJpa.findAll(querySpecifi,pageable);
return resultList;
}