public Long getChargeElectricTimes(Long memberId){
Boolean isDeleted = false;
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Order> criteriaQuery = criteriaBuilder.createQuery(Order.class);
Root<Order> root = criteriaQuery.from(Order.class);
criteriaQuery.select(root);
Predicate restrictions = criteriaBuilder.conjunction();
if( memberId !=null){
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.equal(root.<Long>get("member"),memberId),
criteriaBuilder.equal(root.<Boolean>get("isDeleted"),isDeleted));
}
criteriaQuery.where(restrictions);
return super.count(criteriaQuery,null);
}