jeecg查询拼接sql

cq.add(Restrictions.sqlRestriction("is_state <> 1 ")); 

NVL(datastate, 0) != '1'//值为null是默认为0
cq.addOrder("createDate", SortDirection.desc);

 sql结果集里面有些值是null的

ifnull(is_state,'0') !='1'

 

public void datagrid_defult(DecMainEntity decMain, HttpServletRequest request, HttpServletResponse response,
            DataGrid dataGrid) {
        CriteriaQuery cq = new CriteriaQuery(DecMainEntity.class, dataGrid);
        // 查询条件组装器
        org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, decMain, request.getParameterMap());
        try {

            cq.eq("ieFlag", "D");

            // 自定义追加查询条件
        } catch (Exception e) {
            throw new BusinessException(e.getMessage());
        }
        cq.add();
        this.decMainService.getDataGridReturn(cq, true);
        List<DecMainEntity> list = dataGrid.getResults();
        Map<String, Map<String, Object>> extMap = new HashMap<String, Map<String, Object>>();
        for (DecMainEntity temp : list) {
            // 此为针对原来的行数据,拓展的新字段
            Map m = new HashMap();
            DecMainPage decmainpage1 = JSONObject.parseObject(temp.getContent(), DecMainPage.class);
            m.put("tradeName", decmainpage1.getOwnerName());
            m.put("tradeMode", decmainpage1.getTradeMode_value());
            extMap.put(temp.getId(), m);
        }
        TagUtil.datagrid(response, dataGrid, extMap);
    }

 

posted @ 2020-04-18 08:53  薛柏梁  阅读(760)  评论(0编辑  收藏  举报