hibernate 多查询or的用法

来源:互联网 发布:json key value 数组 编辑:程序博客网 时间:2024/05/21 09:05
@RequestMapping(params = "datagridError")
        public void datagridError(UadptTacActDataEntity uadptTacActData,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
            CriteriaQuery cq = new CriteriaQuery(UadptTacActDataEntity.class, dataGrid);
            //查询条件组装器
            org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, uadptTacActData, request.getParameterMap());
            try{
            //自定义追加查询条件,statusTac是实体类的属性,0是为了优化,比不等于1效率高
                cq.add(Restrictions.or(
                        Restrictions.eq("statusTac", 0),
                        Restrictions.eq("statusTerminal", 0),
                        Restrictions.eq("statusBrand", 0),
                        Restrictions.eq("statusModel", 0),
                        Restrictions.eq("statusCmType", 0),
                        Restrictions.eq("statusDual", 0),
                        Restrictions.eq("statusSoftLock", 0),
                        Restrictions.eq("statusNettypeUni", 0),
                        Restrictions.eq("statusNettypeOth", 0)));
            }catch (Exception e) {
                throw new BusinessException(e.getMessage());
            }
            cq.add();
            this.uadptTacActDataService.getDataGridReturn(cq, true);
            TagUtil.datagrid(response, dataGrid);
        }
0 0
原创粉丝点击