码迷,mamicode.com
首页 > Web开发 > 详细

hibernate criteria Restrictions工具类用法

时间:2018-04-18 21:25:35      阅读:380      评论:0      收藏:0      [点我收藏+]

标签:grid   工具类   any   add   dir   iter   desc   mod   file   

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工具类用法

标签:grid   工具类   any   add   dir   iter   desc   mod   file   

原文地址:https://www.cnblogs.com/Eeexiang/p/8877304.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!