ViewCriteria查詢(OPER_IN)

查詢 where .. in ..app

/**
     * 設置學生基本信息表的註冊狀態,以及註冊時間
     * @param zt
     * @param idArr
     * @date 2017-11-16
     */
    public void sync(String zt, String[] idArr) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date = ZT_TWO.equals(zt) ? df.format(new Date()) : "";
        XsxxglXsjbxxViewImpl xsVo =
            (XsxxglXsjbxxViewImpl)ADFUtils.findIterator("XsxxglXsjbxxView1Iterator").getViewObject();
        ViewCriteria vc = xsVo.createViewCriteria();
        vc.setName("xsvc");
        ViewCriteriaRow vcr = vc.createViewCriteriaRow();
        ViewCriteriaItem item = vcr.ensureCriteriaItem("Xsid");
        item.setOperator(JboCompOper.OPER_IN);
        for (int i = 0; i < idArr.length; i++) {
            item.setValue(i, idArr[i]);
        }
        vc.addElement(vcr);
        xsVo.applyViewCriteria(vc);
        xsVo.setRangeSize(-1);
        xsVo.executeQuery();
        Row[] xsArr = xsVo.getAllRowsInRange();
        xsVo.removeViewCriteria("xsvc");
        xsVo.reset();
        for (Row xsRow : xsArr) {
            xsRow.setAttribute("Zczt", zt);
            xsRow.setAttribute("Zcsj", date);
        }
    }

2.在綁定層綁定其它模塊的VO迭代器(須要導JAR包)進行查詢。code

    /**
     * Container's getter for XtglBmgzmbView1.
     * @return XtglBmgzmbView1
     */
    public XtglBmgzmbViewImpl getXtglBmgzmbView1() {
        return (XtglBmgzmbViewImpl)findViewObject("XtglBmgzmbView1");
    }
    public Boolean isJgh() {
        XtglBmgzmbViewImpl bmgzVo = getXtglBmgzmbView1();
        bmgzVo.setWhereClause("Bmgzbh=:p_bh");
        bmgzVo.defineNamedWhereClauseParam("p_bh", null, null);
        bmgzVo.setNamedWhereClauseParam("p_bh", "003");
        bmgzVo.executeQuery();
        Row row = bmgzVo.first();
        bmgzVo.removeNamedWhereClauseParam("p_bh"); //清空
        String sfqy = (String)row.getAttribute("Sfqy");
        return "1".equals(sfqy);
    }
相關文章
相關標籤/搜索