废话不多说直接贴代码

        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. 数据库:随机显示n条记录

    1.sqlite3数据库select  * from QG  order by random() limit 6 以下显示前10条记录 2.SQL Server数据库select top 10 * f ...

  2. python 读写sql2008 类

    import pymssql class MSSQL: def __init__(self,host,user,pwd,db): self.host = host self.user = user s ...

  3. gnome环境设置

    1.gnome的环境安装sudo apt-get install gnome2.选择gdm3 开机显示不正常:could not apply the stored configuration for ...

  4. SpringCloud学习之【NACOS实现服务的注册与发现】

    根据nacos官方的介绍,Nacos 致力于帮助您发现.配置和管理微服务.Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现.服务配置.服务元数据及流量管理. 具有服务发现和服务健康监 ...

  5. 基于Gin+Gorm框架搭建MVC模式的Go语言后端系统

    文/朱季谦 环境准备:安装Gin与Gorm 本文搭建准备环境:Gin+Gorm+MySql. Gin是Go语言的一套WEB框架,在学习一种陌生语言的陌生框架,最好的方式,就是用我们熟悉的思维去学.作为 ...

  6. PowerProto: gRPC工具链(protoc, protoc-gen-go)的一键安装与版本控制

    ‍PowerProto: gRPC工具链(protoc, protoc-gen-go)的一键安装与版本控制 中文 | English 项目地址:An awesome version control t ...

  7. 搭建MySQL主从实现Django读写分离

    一.MySQL主从搭建 主从配置原理: 主库写日志到 BinLog 从库开个 IO 线程读取主库的 BinLog 日志,并写入 RelayLog 再开一个 SQL 线程,读 RelayLog 日志,回 ...

  8. Python - 对象赋值、浅拷贝、深拷贝的区别

    前言 Python 中不存在值传递,一切传递的都是对象的引用,也可以认为是传址 这里会讲三个概念:对象赋值.浅拷贝.深拷贝 名词解释 变量:存储对象的引用 对象:会被分配一块内存,存储实际的数据,比如 ...

  9. springmvc学习指南 之---第27篇 spring如何实现servlet3.0无web.xml 配置servlet对象的

    writedby 张艳涛 基于web.xml配置,有人说麻烦,tomcat给按照servlet3.0,实现了基于注解@WebServlet,有人说springmvc的springmvc.xml配置麻烦 ...

  10. angular5采坑之旅

    开始尝试angular5,在此记录下踩过的坑以备查询 1.按照element-angular的文档引入后报错 is not part of the compilation output.解决方法--在 ...