コード例 #1
0
  /**
   * 设置查询默认值
   *
   * @param actionForm ActionForm 表单From
   * @param request HttpServletRequest Web请求
   * @param response HttpServletResponse Web结果
   * @throws CDealException 处理异常
   */
  public static void setQueryDefault(
      QueryForm pQueryForm, HttpServletRequest request, HttpServletResponse response)
      throws CDealException {
    // 初始化页面,初始化重大事项综合查询下拉菜单
    QueryForm aWebForm1 = (QueryForm) pQueryForm;
    Connection mConn = null;
    PreparedStatement pstmt = null;
    String str = ""; // 要返回的 string
    String sKey = ""; // 取出的TREEMAP的KEY
    String sValue = ""; // 取出的TREEMAP的value
    ArrayList itemtype;
    try {
      // 从CODEMAP表里取 来源分类 菜单
      ArrayList comeList = CCodeMap.getSortedMap("重大事项登记来源分类");

      // 从CODEMAP表里取 本级政府任务督办 菜单
      ArrayList localList = CCodeMap.getSortedMap("本级政府任务督办督查科");

      // 从CODEMAP表里取 上级任务督办 菜单
      ArrayList upList = CCodeMap.getSortedMap("上级任务督办督查科");

      // 添加 来源分类 到一个数组里面去.然后统一输出到页面
      str = "var department=new Array('','全部'";
      int k = 0;
      for (; k < comeList.size(); k++) {
        LabelValueBean aLabelValueBean = (LabelValueBean) comeList.get(k);
        sKey = aLabelValueBean.getValue(); // 名字
        str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY
        sValue = aLabelValueBean.getLabel(); // 值
        str += "'" + sValue + "'\n"; // 取出的TREEMAP的value
      }
      str += ");\n";
      str += " var permissionitem = new Array (" + k + ");\n";
      str += "permissionitem[0]=new Array('','全部');\n";

      // 添加 上级 事项类别列表
      int j = 1;
      str += "permissionitem[" + j + "]=new Array('','全部'";
      for (int i = 0; i < upList.size(); i++) {
        LabelValueBean aLabelValueBean = (LabelValueBean) upList.get(i);
        sKey = aLabelValueBean.getValue(); // 名字
        str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY
        sValue = aLabelValueBean.getLabel(); // 值
        str += "'" + sValue + "'\n"; // 取出的TREEMAP的value
      }
      str += ");\n";

      j = 2;
      str += "permissionitem[" + j + "]=new Array('','全部'";
      for (int i = 0; i < localList.size(); i++) {
        LabelValueBean aLabelValueBean = (LabelValueBean) localList.get(i);
        sKey = aLabelValueBean.getValue(); // 名字
        str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY
        sValue = aLabelValueBean.getLabel(); // 值
        str += "'" + sValue + "'\n"; // 取出的TREEMAP的value
      }
      str += ");\n";

      // 把部门数组和许可事项输出到页面上
      aWebForm1.setPrintSql(str);

      // 初始化重大事项综合查询下拉菜单
      TreeMap itemstatusList = new TreeMap();
      itemstatusList = CCodeMap.getMapByType("重大事项流程");
      aWebForm1.setItemstatusList(itemstatusList);

    } catch (Exception e) {
      throw new CDealException("设置查询默认值时失败。", e);
    }
  }
コード例 #2
0
  /**
   * 查询处理
   *
   * @param actionForm ActionForm 表单From
   * @param request HttpServletRequest Web请求
   * @param response HttpServletResponse Web结果
   * @throws CDealException 处理异常
   */
  public static void doQuery(
      QueryForm pQueryForm, HttpServletRequest request, HttpServletResponse response)
      throws CDealException {
    try {

      // 查询数据SQL语句
      //      String msSql = "select
      // t.BUSIINDEXID,t.ITEMID,t.ITEMTITLE,t.FROMCOMPANY,t.ITEMTYPE,t.DEPARTMENT, " +
      //                     "t.LIMITFOREWARN,t.LIMITYELLOW,t.LIMITRED,c.abbrname from
      // T_JC_ZDSX_DCK_BUSIINDEX t" +
      //                     ",t_Yw_Dck_Jcj_Taskbreak b,t_sys_department c where t.itemid = b.itemid
      // and b.firstflag = 1 and b.transactdepartment = c.id ";
      String msSql =
          "select t.BUSIINDEXID,t.ITEMID,t.ITEMTITLE,t.FROMCOMPANY,t.ITEMTYPE,t.DEPARTMENT, "
              + "t.LIMITFOREWARN,t.LIMITYELLOW,t.LIMITRED from T_JC_ZDSX_DCK_BUSIINDEX t,t_yw_dck_jcj_resister p where t.itemid = p.itemid and (t.spare1=0 or t.spare1 is null)  ";
      String msOrder =
          "order by t.LIMITRED desc,T.LIMITYELLOW desc,T.LIMITFOREWARN desc, BUSIINDEXID desc"; // 排序语句

      // 查询子条件
      String msSqlWhere = "";
      String msTemp = pQueryForm.getItemid(); // 编号
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.itemid like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getFromcompany(); // 来文单位
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.fromcompany like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getItemtitle(); // 督办标题
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.itemtitle like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getItemtype(); // 类别
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.itemtype =" + msTemp;
      }
      msTemp = pQueryForm.getItemstatus(); // 重大事项状态类别
      if (msTemp != null && msTemp.length() > 0 && msTemp.equals("1")) {
        msSqlWhere += " and p.ITEMSTATUS =1";
      }
      if (msTemp != null && msTemp.length() > 0 && msTemp.equals("2")) {
        msSqlWhere += " and p.ITEMSTATUS =2";
      }
      if (msTemp != null && msTemp.length() > 0 && msTemp.equals("3")) {
        msSqlWhere += " and p.ITEMSTATUS =3";
      }
      if (msTemp != null
          && msTemp.length() > 0
          && (msTemp.equals("4")
              || msTemp.equals("5")
              || msTemp.equals("6")
              || msTemp.equals("7"))) {
        msSqlWhere += " and p.ITEMSTATUS =4";
      }
      if (msTemp != null && msTemp.length() > 0 && msTemp.equals("8")) {
        msSqlWhere += " and p.ITEMSTATUS =7";
      }
      msTemp = pQueryForm.getDepartment(); // 来源分类
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.department =" + msTemp;
      }
      msTemp = pQueryForm.getFromdate1(); // 收文日期,起
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.INITIALDATE >= to_date('" + msTemp + "','yyyy-mm-dd')";
      }
      msTemp = pQueryForm.getFromdate2(); // 收文日期,止
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and t.INITIALDATE <= to_date('" + msTemp + "','yyyy-mm-dd')";
      }

      msSql = msSql + msSqlWhere; // 主查询语句 加上 查询子条件

      CDataPage dataPage = new CDataPage(); // 翻页实现类
      dataPage.setQuerySql(msSql); // 设置查询语句
      dataPage.setOrderStr(msOrder); // 设置排序语句
      dataPage.setQueryFormOrderColumn(pQueryForm.getQueryFormOrderColumn()); // 查询页面排序的字段
      dataPage.setPageRowCount(CConstants.PAGE_ROW_COUNT); // 每页行数
      dataPage.setFormName("forms[0]");
      dataPage.init(request);
      request.setAttribute(CConstants.DATA_PAGE_OBJECT, dataPage);
    } catch (Exception e) {
      throw new CDealException("根据输入条件进行查询时失败。", e);
    }
  }