废话不多说直接贴代码

        Specification<Employee> employeeSpecification = new Specification<Employee>() {
@Override
public Predicate toPredicate(Root<Employee> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicateList = Lists.newArrayList(); //isDelete
Predicate isDeletePredicate = criteriaBuilder.or(criteriaBuilder.isNull(root.get("isDelete")),criteriaBuilder.equal(root.get("isDelete"),Constants.NOT_DELETE));
predicateList.add(isDeletePredicate); //role_type 角色 为员工
Predicate roleTypePredicate = criteriaBuilder.equal(root.get("roleType"),Constants.ROLE_TYPE_EMPLOYEE);
predicateList.add(roleTypePredicate); //departmentId
if(departmentId!=null){
Predicate departmentPredicate = criteriaBuilder.equal(root.get("department").get("id"),departmentId);
predicateList.add(departmentPredicate);
} //去除已参加会议的人员 not in
if(joinMeetingEmpIdList!=null&&!joinMeetingEmpIdList.isEmpty()){
Predicate joinMeetingEmpIdListInPredicate = criteriaBuilder.not(root.get("id").in(joinMeetingEmpIdList));
predicateList.add(joinMeetingEmpIdListInPredicate);
} return criteriaQuery.where(predicateList.toArray(new Predicate[predicateList.size()])).getRestriction();
}
};
Pageable pageable = PageUtils.getPageable(pageIndex, pageSize); Page<Employee> page = this.employeeRespository.findAll(employeeSpecification, pageable);

Specification使用notin的更多相关文章

  1. JPA使用Specification构建动态查询

    封装Specification查询条件,在Spring Data JPA 2.0以前使用 Specifications 这个辅助类来操作where.not.and和or连接,在2.0版本以后这个类会被 ...

  2. 使用CocoaPods过程中 Unable to find a specification for

    文章转自:http://blog.csdn.net/zhangao0086/article/details/39703083 当把CocoaPods生成的workspace移动到上层目录时,需要改下P ...

  3. 规约模式Specification的学习

    最近一直在看DDD开发  规约似乎用得很普遍. 但是还是理解不了.所以记录下学习的进度.- 规约(Specification)模式 目的:查询语句和查询条件的分离 写了一个关于规约的模拟小程序 cla ...

  4. [.NET领域驱动设计实战系列]专题三:前期准备之规约模式(Specification Pattern)

    一.前言 在专题二中已经应用DDD和SOA的思想简单构建了一个网上书店的网站,接下来的专题中将会对该网站补充更多的DDD的内容.本专题作为一个准备专题,因为在后面一个专题中将会网上书店中的仓储实现引入 ...

  5. EF架构~引入规约(Specification)模式,让程序扩展性更强

    回到目录 规约(Specification)模式:第一次看到这东西是在microsoft NLayer项目中,它是微软对DDD的解说,就像petshop告诉了我们MVC如何使用一样,这个规约模式最重要 ...

  6. Tomcat7.0启动报错:java.lang.illegalargumentexception:taglib definition not consisten with specification version

    Tomcat7.0启动报错:java.lang.illegalargumentexception:taglib definition not consisten with specification ...

  7. The JSP specification requires that an attribute name is preceded by whitespace

    一个jsp页面在本地运行一点问题没有,发布到服务器就报错了: The JSP specification requires that an attribute name is preceded by ...

  8. 如何阅读《ECMAScript 2015 Language Specification》

    你不需要把<ECMAScript 2015 Language Specification>通读一遍,因为没那个必要.   阮一峰建议: 对于一般用户来说,除了第4章,其他章节都涉及某一方面 ...

  9. ORA-00119: invalid specification for system parameter LOCAL_LISTENER - 转

    错误分析 listener 可以正常启动: [oracle@o_target admin]$ cat listener.ora# listener.ora Network Configuration ...

随机推荐

  1. 长按短按控制LED灯-ESP32中断处理

    #include <stdio.h> #include <string.h> #include <stdlib.h> #include "freertos ...

  2. .NET Core/.NET5/.NET6 开源项目汇总11:WPF组件库1

    系列目录     [已更新最新开发文章,点击查看详细] WPF(Windows Presentation Foundation)是微软推出的基于Windows 的用户界面框架,属于.NET Frame ...

  3. Java基础00-修饰符18

    1. 包 1.1 包的概述和使用 通过记事本的方法 package com.itheima;public class HelloWorld { public static void main(Stri ...

  4. 1.在配置XML文件时出现reference file contains errors (http://www.springframework.org/schema/beans/...解决方案

    解决方案: 第一步:将 Preferences > XML > XML Files > Validation中"Honour all XML schema location ...

  5. dubbo(四)

    前言 1.浅谈架构的发展 首先,要了解dubbo,就得了解,它是在什么背景下产生的?这就需要从架构的发展说起. 孟老师从事软件开发2008年份,那时候我上高一,那个时候,淘宝.京东都还没有火起来.那个 ...

  6. Spring 框架中都用到了哪些设计模式

    Spring 框架中都用到了哪些设计模式? Spring 框架中使用到了大量的设计模式,下面列举了比较有代表性的: 1.代理模式-在 AOP 和 remoting 中被用的比较多. 2.单例模式:在 ...

  7. Github上比较全的学习路线

    github地址:https://github.com/kamranahmedse/developer-roadmap/blob/master/translations/chinese

  8. Python自动化测试面试题-Linux篇

    目录 Python自动化测试面试题-经验篇 Python自动化测试面试题-用例设计篇 Python自动化测试面试题-Linux篇 Python自动化测试面试题-MySQL篇 Python自动化测试面试 ...

  9. 第二十一篇 -- QTimer实现秒表功能

    效果图: 程序一开始就开始计时,当完成了相关功能(在线程中完成)之后,就触发停止信号,停止定时器. time.py #!/usr/bin/env python # _*_ coding: UTF-8 ...

  10. airtest前期准备(pocoSDK+unity打apk包+安装pocoui库)

    只介绍unity的环境准备,cocos的可以参考官方文档    https://poco-chinese.readthedocs.io/zh_CN/latest/source/doc/integrat ...