zoukankan      html  css  js  c++  java
  • 随便记录

    private Specification<CuserQuestion> buildSpecification(CuserQuestionDTO cuserQuestionDTO) {
    return new Specification<CuserQuestion>() {
    public Predicate toPredicate(Root<CuserQuestion> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
    List<Predicate> predicate = new ArrayList<Predicate>();

    if (!CheckParam.isNull(cuserQuestionDTO.getContent())) {
    predicate.add(builder.like(root.get("content"), "%" + cuserQuestionDTO.getContent() + "%"));
    }

    if (!CheckParam.isNull(cuserQuestionDTO.getStatus())) {
    predicate.add(builder.equal(root.get("status"),cuserQuestionDTO.getStatus()));
    }

    if (!CheckParam.isNull(cuserQuestionDTO.getEndTime())) {
    predicate.add(builder.between(root.get("createTime"),cuserQuestionDTO.getStartTime(),cuserQuestionDTO.getEndTime()));
    }
    predicate.add(builder.equal(root.get("isDelete"),0));
    Predicate[] pre = new Predicate[predicate.size()];
    return query.where(predicate.toArray(pre)).getRestriction();
    }
    };
    }

    ParamConfig paramConfig = new ParamConfig();
    Integer pageSize = paramConfig.getPageSize(commentOrderDTO.getPageSize());
    Integer pageOne = paramConfig.getPageNo(commentOrderDTO.getPageOne());

    Sort sort = new Sort(Sort.Direction.DESC, "id");
    Pageable pageable = PageRequest.of(pageOne,pageSize ,sort);

  • 相关阅读:
    Git 中 .gitignore 的配置语法
    DMX512协议
    k8s 报错总结
    yum 源配置
    docker 安装 docker-compose
    docker 搭建 Harbor 仓库
    linux 远程执行命令
    远程从服务器A拷贝文件到服务器B
    docker 搭建私服仓库
    awk和xargs清除docker 容器、镜像
  • 原文地址:https://www.cnblogs.com/laixin09/p/10083461.html
Copyright © 2011-2022 走看看