hibernate criteria Restrictions工具类用法

Posted eeexiang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hibernate criteria Restrictions工具类用法相关的知识,希望对你有一定的参考价值。

CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
// 查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);
Restrictions.or(Restrictions.ilike("userName", searchValue, MatchMode.ANYWHERE), Restrictions.ilike("realName", searchValue, MatchMode.ANYWHERE));
Restrictions.or(Restrictions.ilike("userOrgList.tsDepart.departname", searchValue, MatchMode.ANYWHERE), Restrictions.ilike("userKey", searchValue, MatchMode.ANYWHERE));
Restrictions.or(Restrictions.ilike("userQuarters", searchValue, MatchMode.ANYWHERE), Restrictions.ilike("userWork", searchValue, MatchMode.ANYWHERE));
cq.add();
this.systemService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);

无限添加or

 List<TSUser> list = criteria.add(Restrictions.or(Restrictions.like("description", key,MatchMode.ANYWHERE),
                             Restrictions.or(Restrictions.like("name", key,MatchMode.ANYWHERE),
                           Restrictions.or(Restrictions.like("direct", key,MatchMode.ANYWHERE),
                           Restrictions.or(Restrictions.like("mainplay",key,MatchMode.ANYWHERE),
                               Restrictions.like("filearea", key,MatchMode.ANYWHERE)))))).list();

 









以上是关于hibernate criteria Restrictions工具类用法的主要内容,如果未能解决你的问题,请参考以下文章

Hibernate中Criteria的完整用法

hibernate的Criteria Query(转)

hibernate criteria模糊查询 怎么写

Hibernate- Criteria 简易

Hibernate学习笔记---Criteria接口

hibernate-criteria查询