• 不知道对象的传递那些参数


     public List<IosPersonInfoBO> queryCorpLists(IosPersonInfoBO object,
       List<String> depIdList, boolean loadext) throws Exception {
      Session session = super.getSession();

      List<IosPersonInfoBO> objectBOList = new ArrayList();
      // 初始化一个查询总记录SQL语句的字符串
      StringBuffer queryAcountString = new StringBuffer(
        "select count(ipi.Oid)");
      // 初始化一个查询的SQL语句的字符串
      StringBuffer queryString = new StringBuffer(
        "select {ipi.*},{ipie.*},{idi.*}");
      // 判断是否是买家还是卖家
      queryAcountString
        .append(" from ios_person_info ipi "
          + " left join ios_person_info_ext ipie on ipi.oid = ipie.user_id "
          + " left join ios_dept_info idi on  ipi.int_deptid = idi.int_dept_id "
          + " where ipi.stop_flag = 0 ");

      queryString
        .append(" from ios_person_info ipi "
          + " left join ios_person_info_ext ipie on ipi.oid = ipie.user_id "
          + " left join ios_dept_info idi on  ipi.int_deptid = idi.int_dept_id "
          + " where ipi.stop_flag = 0 ");
      // 根据loadext选用不同的查询条件
      if (loadext) {
       // 判断部门列表是否为空
       if (depIdList != null && depIdList.size() > 0) {
        queryAcountString = queryAcountString.append(" and ( ");
        queryString = queryString.append(" and ( ");
        for (int i = 1; i < depIdList.size(); i++) {
         queryAcountString = queryAcountString
           .append(" ipi.int_deptid = ? or");
         queryString = queryString.append(" ipi.int_deptid = ? or");
        }
        queryAcountString = queryAcountString
          .append(" ipi.int_deptid = ? )");
        queryString = queryString.append(" ipi.int_deptid = ? )");
       } else {
        // 部门ID是否为空
        if (object.getIntDeptid() != null
          && !object.getIntDeptid().equalsIgnoreCase("")) {
         queryAcountString = queryAcountString
           .append(" and ipi.int_deptid = ? ");
         queryString = queryString
           .append(" and ipi.int_deptid = ? ");
        }
       }
      } else {
       // 部门ID是否为空
       if (object.getIntDeptid() != null
         && !object.getIntDeptid().equalsIgnoreCase("")) {
        queryAcountString = queryAcountString
          .append(" and ipi.int_deptid = ? ");
        queryString = queryString.append(" and ipi.int_deptid = ? ");
       }
      }
      // oid是否为空
      if (object.getOid() != null && !object.getOid().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString.append(" and ipi.oid = ?");
       queryString = queryString.append(" and ipi.oid = ?");
      }
      // 姓名是否为空
      if (object.getUserName() != null
        && !object.getUserName().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipi.user_name like ?");
       queryString = queryString.append(" and ipi.user_name like ?");
      }
      // 登陆ID是否为空
      if (object.getStrLoginId() != null
        && !object.getStrLoginId().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipi.str_login_id = ?");
       queryString = queryString.append(" and ipi.str_login_id = ?");
      }
      // 集团ID是否为空
      if (object.getGroupId() != null
        && !object.getGroupId().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipi.group_id = ?");
       queryString = queryString.append(" and ipi.group_id = ?");
      }

      // 职务是否为空
      if (object.getHeadship() != null
        && !object.getHeadship().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipi.headship like ?");
       queryString = queryString.append(" and ipi.headship like ?");
      }
      // 判断userNo是否为空
      if (object.getUserNo() != null
        && !object.getUserNo().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipi.user_no like ?");
       queryString = queryString.append(" and ipi.user_no like ?");
      }
      // 首选呼叫号码是否为空
      if (object.getExtBo().getPrimaryCallPhone() != null
        && !object.getExtBo().getPrimaryCallPhone()
          .equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipie.primary_call_phone like ?");
       queryString = queryString
         .append(" and ipie.primary_call_phone like ?");
      }
      // 首选短信号码是否为空
      if (object.getExtBo().getPrimarySmPhone() != null
        && !object.getExtBo().getPrimarySmPhone().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipie.primary_sm_phone = ?");
       queryString = queryString.append(" and ipie.primary_sm_phone = ?");
      }
      // 生日当天自动发送生日祝福
      if (object.getExtBo().getBirthdayCongraduationYn() != null
        && !object.getExtBo().getBirthdayCongraduationYn()
          .equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ipie.birthday_congraduation_yn = ?");
       queryString = queryString
         .append(" and ipie.birthday_congraduation_yn = ?");
      }
      // 启用生日提醒是否为空
      if (object.getExtBo().getBirthdayHintValid() != null
        && !object.getExtBo().getBirthdayHintValid().equalsIgnoreCase(
          "")) {
       queryAcountString = queryAcountString
         .append(" and ipie.birthday_hint_valid = ?");
       queryString = queryString
         .append(" and ipie.birthday_hint_valid = ?");
      }
      // 模糊查询是否为空
      if (object.getIllegibilityQuery() != null
        && !object.getIllegibilityQuery().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and ( ipi.email like ? or ipi.fax like ? or "
           + " ipi.employee_no like ? or ipi.user_name like ? or "
           + " ipie.OFFICIAL_PHONE like ? or ipie.HOME_PHONE like ? or "
           + " ipie.MOBILE like ? or ipie.XIAO_LING_TONG like ? or "
           + " ipie.qq like ? or ipie.msn like ?) ");
       queryString = queryString
         .append(" and ( ipi.email like ? or ipi.fax like ? or "
           + " ipi.employee_no like ? or ipi.user_name like ? or "
           + " ipie.OFFICIAL_PHONE like ? or ipie.HOME_PHONE like ? or "
           + " ipie.MOBILE like ? or ipie.XIAO_LING_TONG like ? or "
           + " ipie.qq like ? or ipie.msn like ?) ");
      }
      // 生日日期(无年份的)是否为空
      if (object.getBirthdayWithoutYear() != null
        && !object.getBirthdayWithoutYear().equalsIgnoreCase("")) {
       queryAcountString = queryAcountString
         .append(" and to_char(ipi.BIRTHDAY,'mm-dd') like ?");
       queryString = queryString
         .append(" and to_char(ipi.BIRTHDAY,'mm-dd') like ?");
      }

      queryAcountString = queryAcountString
        .append(" order by idi.dep_id_sort_list , ipi.user_name ");
      queryString = queryString
        .append(" order by idi.dep_id_sort_list , ipi.user_name ");
      Logger.getRootLogger().info("queryString:" + queryString.toString());

      // 将queryAcountString中的属性放入Query集中
      SQLQuery qCount = session.createSQLQuery(queryAcountString.toString());

      // 将queryString中的属性放入Query集中
      SQLQuery q = session.createSQLQuery(queryString.toString());
      int m = 0;
      int n = 0;

      // 根据loadext选用不同的查询条件
      if (loadext) {
       // 判断部门列表是否为空
       if (depIdList != null && depIdList.size() > 0) {
        for (int j = 0; j < depIdList.size(); j++) {
         q.setString(m++, (String) depIdList.get(j));
         qCount.setString(n++, (String) depIdList.get(j));
        }
       } else {
        // 判部门ID是否为空,否则分别给queryAcountString和queryString中判断条件赋值
        if (object.getIntDeptid() != null
          && !object.getIntDeptid().equalsIgnoreCase("")) {
         q.setString(m++, object.getIntDeptid());
         qCount.setString(n++, object.getIntDeptid());
        }
       }
      } else {
       // 判部门ID是否为空,否则分别给queryAcountString和queryString中判断条件赋值
       if (object.getIntDeptid() != null
         && !object.getIntDeptid().equalsIgnoreCase("")) {
        q.setString(m++, object.getIntDeptid());
        qCount.setString(n++, object.getIntDeptid());
       }
      }
      // 判断oid是否为空,否则给查询属性赋值
      if (object.getOid() != null && !object.getOid().equalsIgnoreCase("")) {
       qCount.setString(m++, object.getOid());
       q.setString(n++, object.getOid());
      }
      // 判断姓名是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getUserName() != null
        && !object.getUserName().equalsIgnoreCase("")) {
       q.setString(m++, "%" + object.getUserName() + "%");
       qCount.setString(n++, "%" + object.getUserName() + "%");
      }
      // 判断登陆ID是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getStrLoginId() != null
        && !object.getStrLoginId().equalsIgnoreCase("")) {
       q.setString(m++, object.getStrLoginId());
       qCount.setString(n++, object.getStrLoginId());
      }
      // 判断集团ID是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getGroupId() != null
        && !object.getGroupId().equalsIgnoreCase("")) {
       q.setString(m++, object.getGroupId());
       qCount.setString(n++, object.getGroupId());
      }

      // 判断职务是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getHeadship() != null
        && !object.getHeadship().equalsIgnoreCase("")) {
       q.setString(m++, "%" + object.getHeadship() + "%");
       qCount.setString(n++, "%" + object.getHeadship() + "%");
      }
      // 判断userNo是否为空
      if (object.getUserNo() != null
        && !object.getUserNo().equalsIgnoreCase("")) {
       q.setString(m++, "%" + object.getUserNo() + "%");
       qCount.setString(n++, "%" + object.getUserNo() + "%");
      }
      // 判断首选呼叫号码是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getExtBo().getPrimaryCallPhone() != null
        && !object.getExtBo().getPrimaryCallPhone()
          .equalsIgnoreCase("")) {
       q.setString(m++, "%" + object.getExtBo().getPrimaryCallPhone()
         + "%");
       qCount.setString(n++, "%" + object.getExtBo().getPrimaryCallPhone()
         + "%");
      }
      // 判断首选短信号码是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getExtBo().getPrimarySmPhone() != null
        && !object.getExtBo().getPrimarySmPhone().equalsIgnoreCase("")) {
       q.setString(m++, object.getExtBo().getPrimarySmPhone());
       qCount.setString(n++, object.getExtBo().getPrimarySmPhone());
      }
      // 生日当天自动发送生日祝福
      if (object.getExtBo().getBirthdayCongraduationYn() != null
        && !object.getExtBo().getBirthdayCongraduationYn()
          .equalsIgnoreCase("")) {
       q.setString(m++, object.getExtBo().getBirthdayCongraduationYn());
       qCount.setString(n++, object.getExtBo()
         .getBirthdayCongraduationYn());
      }
      // 启用生日提醒是否为空
      if (object.getExtBo().getBirthdayHintValid() != null
        && !object.getExtBo().getBirthdayHintValid().equalsIgnoreCase(
          "")) {
       q.setString(m++, object.getExtBo().getBirthdayHintValid());
       qCount.setString(n++, object.getExtBo().getBirthdayHintValid());
      }
      // 判断模糊查询是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getIllegibilityQuery() != null
        && !object.getIllegibilityQuery().equalsIgnoreCase("")) {
       for (int k = 0; k < 10; k++) {
        q.setString(m++, "%" + object.getIllegibilityQuery() + "%");
        qCount
          .setString(n++, "%" + object.getIllegibilityQuery()
            + "%");
       }
      }
      // 判断生日日期(无年份的)是否为空,否则分别给queryAcountString和queryString中判断条件赋值
      if (object.getBirthdayWithoutYear() != null
        && !object.getBirthdayWithoutYear().equalsIgnoreCase("")) {
       q.setString(m++, "%" + object.getBirthdayWithoutYear() + "%");
       qCount.setString(n++, "%" + object.getBirthdayWithoutYear() + "%");
      }

      // 是否需要分页
      if (object.getPageFlag() == null || "".equals(object.getPageFlag())) {
       // 设置记录总数
       object.getPageData().setTotalRow(
         ((java.math.BigDecimal) (qCount.list().iterator().next()))
           .intValue());

       // 设置页面第一行记录
       q.setFirstResult((object.getPageData().getPageNum() - 1)
         * object.getPageData().getPageSize());

       // 设置每页记录的最大数
       q.setMaxResults(object.getPageData().getPageSize());
      }

      q.addEntity("ipi", IosPersonInfo.class);
      q.addEntity("ipie", IosPersonInfoExt.class);
      q.addEntity("idi", IosDeptInfo.class);

      // 存放q里的记录
      List<Object[]> objectList = q.list();

      IosPersonInfoBO iosPersonInfoBO;

      IosPersonInfoExtBO iosPersonInfoExtBO;

      Iterator iter = objectList.iterator();

      // 遍历列表,将列表中的属性赋给EpsOrderBO对象
      while (iter.hasNext()) {
       iosPersonInfoBO = new IosPersonInfoBO();
       iosPersonInfoExtBO = new IosPersonInfoExtBO();
       Object[] o = (Object[]) iter.next();

       IosPersonInfo iosPersonInfo = (IosPersonInfo) o[0];
       IosPersonInfoExt iosPersonInfoExt = (IosPersonInfoExt) o[1];
       IosDeptInfo iosDeptInfo = (IosDeptInfo) o[2];

       // 将iosPersonInfo转化为iosPersonInfoBO
       IosPersonInfoHelper personHelp = new IosPersonInfoHelper();
       iosPersonInfoBO = personHelp.wrapPersonInfoMtoB(iosPersonInfo);
       if (iosPersonInfoExt != null) {
        IosPersonInfoExtHelper extHelp = new IosPersonInfoExtHelper();
        iosPersonInfoExtBO = extHelp
          .wrapPersonInfoExtMtoB(iosPersonInfoExt);
        iosPersonInfoBO.setExtBo(iosPersonInfoExtBO);
       }
       if (iosDeptInfo != null) {
        iosPersonInfoBO.setDeptName(iosDeptInfo.getStrName());
       }
       objectBOList.add(iosPersonInfoBO);
       this.getSession().evict(iosPersonInfo);
       this.getSession().evict(iosPersonInfoExt);
       this.getSession().evict(iosDeptInfo);
      }
      return objectBOList;
     }

  • 相关阅读:
    Oracle误删除数据和表的恢复办法包括truncate
    SQL中简单函数介绍
    SQL中的null
    oracle数据库实例后台进程
    常用查询视图
    AIX 常用命令积累(未完待续)
    查询当前用户下的表/查询某一个用户的表
    查询统计运行和采控库里所有用户下的记录数大于5000万条的表
    使用orace数据库自带的sqldeveloper
    PL/SQL Developer
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9332059.html
Copyright © 2020-2023  润新知