suxiaoyang 6 gadi atpakaļ
vecāks
revīzija
11e9ea73eb

+ 5 - 4
mysql-starter/src/main/java/com/yihu/mysql/query/BaseJpaService.java

@ -162,10 +162,11 @@ public abstract class BaseJpaService<T, R extends CrudRepository> {
        Root<T> root = query.from(getEntityClass());
        List<Predicate> ls = new ArrayList<>();
        for(int i=0; i< fields.length; i++){
            if(values[i].getClass().isArray())
                ls.add(criteriaBuilder.in(root.get(fields[i]).in((Object[])values[i])));
            else
            if (values[i].getClass().isArray()) {
                ls.add(criteriaBuilder.in(root.get(fields[i]).in((Object[]) values[i])));
            } else {
                ls.add(criteriaBuilder.equal(root.get(fields[i]), values[i]));
            }
        }
        query.where(ls.toArray(new Predicate[ls.size()]));
        return entityManager
@ -342,7 +343,7 @@ public abstract class BaseJpaService<T, R extends CrudRepository> {
     * @param sorts
     * @return
     */
    public Pageable creatPage(Integer page, Integer size, String sorts){
    public Pageable createPage(Integer page, Integer size, String sorts){
        PageRequest pageRequest = null;
        if(null == page || page <= 0){
            page = defaultPage;