public String queryCondition(String json) {

    User user = ActionContext.getCurrentUserInThread();

    Connection conn = DBUtil.getConnection();
    String domresult = "";
    try {

      // 组织查询条件
      PageManager page = RequestUtil.getPageManager(json);
      String condition = RequestUtil.getConditionList(json).getConditionWhere();
      String orderFilter = RequestUtil.getOrderFilter(json);
      condition += orderFilter;
      if (page == null) page = new PageManager();
      page.setFilter(condition);

      String sql = "SELECT * FROM " + "BU_SPYW_CBFASP_GCJSXMZJFBHTBAB t";
      BaseResultSet bs = DBUtil.query(conn, sql, page);

      domresult = bs.getJson();

    } catch (Exception e) {
      DaoException.handleMessageException("*********查询出错!*********");
    } finally {
      DBUtil.closeConnetion(conn);
    }
    return domresult;
  }
  public String queryCondition(String json) throws Exception {
    Connection conn = DBUtil.getConnection();
    String domresult = "";
    try {

      // 组织查询条件
      PageManager page = RequestUtil.getPageManager(json); // 获取查询后得到的记录数通过Util中的方法进行分页
      String condition = RequestUtil.getConditionList(json).getConditionWhere(); // 获取查询的语句
      // condition += "  and sss='ddd' "
      String orderFilter = RequestUtil.getOrderFilter(json); // 获取排序方法

      condition += orderFilter; // 把查询出来的数据进行排序

      if (page == null) page = new PageManager();
      page.setFilter(condition);

      conn.setAutoCommit(false);
      BaseResultSet bs = DBUtil.query(conn, SQL_QUERY, page); // 连接数据库,进行查询,结果集给bs
      domresult = bs.getJson(); // 把转换好的数据给domresult

    } catch (Exception e) {
      DBUtil.rollbackConnetion(conn);
      logger.error("信息查询失败!");
      e.printStackTrace(System.out);
    } finally {
      DBUtil.closeConnetion(conn);
    }
    return domresult;
  }
Пример #3
0
  public String queryCondition(String json, JxsbDsjjVO vo, Map map) {

    User user = ActionContext.getCurrentUserInThread();

    Connection conn = DBUtil.getConnection();
    String domresult = "";
    try {

      // 组织查询条件
      PageManager page = RequestUtil.getPageManager(json);
      String condition = RequestUtil.getConditionList(json).getConditionWhere();
      String orderFilter = RequestUtil.getOrderFilter(json);
      condition += BusinessUtil.getCommonCondition(user, null);
      condition += orderFilter;
      if (page == null) page = new PageManager();
      page.setFilter(condition);

      String sql =
          "select * from jxsb_dsjj d "
              + "left join JXSB_SYGL s on d.jxsb_sygl_uid=s.jxsb_sygl_uid "
              + "left join JXSB_SYDJ j on s.jxsb_sygl_uid=j.jxsb_sygl_uid "
              + "left join JXSB_JCYS c on s.jxsb_sygl_uid=c.jxsb_sygl_uid "
              + "left join JXSB_AZGC g on s.jxsb_sygl_uid=g.jxsb_sygl_uid "
              + "left join az_company a on d.BY_COMPANY_DL_UID=a.AZ_COMPANY_UID "
              + "left join jxsb b on b.jxsb_uid=s.jxsb_uid  ";
      BaseResultSet bs = DBUtil.query(conn, sql, page);
      // 合同表
      // bs.setFieldTranslater("HTID", "合同表", "ID", "NAME");
      // 项目下达库
      // bs.setFieldTranslater("XDKID", "GC_TCJH_XMXDK", "ID", "XMMC");
      // 标段表
      // bs.setFieldTranslater("BDID", "GC_XMBD", "GC_XMBD_ID", "BDMC");

      // 设置字典

      // 设置查询条件
      // bs.setFieldDateFormat("JLRQ", "yyyy-MM");// 计量月份
      // bs.setFieldThousand("DYJLSDZ");

      domresult = bs.getJson();

    } catch (Exception e) {
      DaoException.handleMessageException("*********查询出错!*********");
    } finally {
      DBUtil.closeConnetion(conn);
    }
    return domresult;
  }