关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、3102411850 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 6797|回复: 1

[Minidao] 自定义追加查询条件之OR

[复制链接]
发表于 2019-3-2 14:23:19 | 显示全部楼层 |阅读模式
//查询条件组装器
                org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tpmEquipmentInfo, request.getParameterMap());
                try{
                        //自定义追加查询条件
                        if(null != testID && !"".equals(testID) && !"null".equals(testID)){
                                System.out.println(testID);
                                cq.eq("stovecodeId", testID) or cq.eq("useDepartmentId", testID) or cq.eq("useLocationId", testID);
                        }
                }catch (Exception e) {
                        throw new BusinessException(e.getMessage());
                }
                cq.add();

想要追加这个:cq.eq("stovecodeId", testID) or cq.eq("useDepartmentId", testID) or cq.eq("useLocationId", testID);该怎么写?求解
 楼主| 发表于 2019-3-2 15:53:56 | 显示全部楼层
解决了解决了,哈哈:
cq.add(Restrictions.or(Restrictions.eq("stovecodeId",testID),Restrictions.or(Restrictions.eq("useDepartmentId",testID), Restrictions.eq("useLocationId",testID))));
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表