Ejemplo n.º 1
0
  /*
   * 查询批次下的所有学习中心
   *
   * @see
   * net.cedu.biz.enrollment.BranchEnrollQuotaBiz#findBranchEnrollQuotaByBId
   * (int)
   */
  public List<BranchEnrollQuota> findBranchEnrollQuotaByBId(int batchId) throws Exception {
    List<BranchEnrollQuota> branchenrollquotalst = null;
    PageParame p = new PageParame();
    String hqlparam = "";
    List<Object> list = new ArrayList<Object>();
    if (batchId != 0) {
      hqlparam += " and batchId =" + Constants.PLACEHOLDER;
      list.add(batchId);
    }
    hqlparam += " and deleteFlag=" + Constants.PLACEHOLDER;
    list.add(Constants.DELETE_FALSE);
    p.setHqlConditionExpression(hqlparam);
    p.setValues(list.toArray());

    Long[] branchenrollquotaids = branchenrollquotaDao.getIDs(p);

    if (branchenrollquotaids != null && branchenrollquotaids.length != 0) {
      branchenrollquotalst = new ArrayList<BranchEnrollQuota>();
      for (int i = 0; i < branchenrollquotaids.length; i++) {
        BranchEnrollQuota beq =
            this.findBranchEnrollQuotaById(Integer.valueOf(branchenrollquotaids[i].toString()));
        BranchEnrollQuota branchenrollquota = beq;
        Branch branch = branchBiz.findBranchById(branchenrollquota.getBranchId());
        if (branch != null) {
          branchenrollquota.setBranchName(branch.getName());
        }

        branchenrollquotalst.add(branchenrollquota);
      }
    }
    return branchenrollquotalst;
  }
Ejemplo n.º 2
0
  /*
   * 查询学习中心指标按批次和中心Id
   *
   * @see net.cedu.biz.enrollment.BranchEnrollQuotaBiz#
   * findBranchEnrollQuotaByBtachIdAndBranchId(int, int)
   */
  public BranchEnrollQuota findBranchEnrollQuotaByBtachIdAndBranchId(int batchId, int branchId)
      throws Exception {
    BranchEnrollQuota beq = null;
    PageParame p = new PageParame();
    String hqlparam = "";
    List<Object> list = new ArrayList<Object>();
    if (batchId != 0) {
      hqlparam += " and batchId=" + Constants.PLACEHOLDER;
      list.add(batchId);
    }
    if (branchId != 0) {
      hqlparam += " and branchId=" + Constants.PLACEHOLDER;
      list.add(branchId);
    }
    hqlparam += " and deleteFlag=";
    list.add(Constants.DELETE_FALSE);
    p.setHqlConditionExpression(hqlparam);
    p.setValues(list.toArray());
    Long[] branchenrollquotaids = branchenrollquotaDao.getIDs(p);
    if (branchenrollquotaids != null && branchenrollquotaids.length != 0) {

      for (int i = 0; i < branchenrollquotaids.length; i++) {
        // 修改人董溟浩,原作者循环取最后一个,逻辑有问题,所以改为跳过之前的直接取最后一个
        if (i == branchenrollquotaids.length - 1) {
          beq = new BranchEnrollQuota();
          beq = this.findBranchEnrollQuotaById(Integer.valueOf(branchenrollquotaids[i].toString()));
          GlobalEnrollBatch globalenrollbatch =
              globalenrollbatchBiz.findGlobalEnrollBatchById(beq.getBatchId());
          if (globalenrollbatch != null) {
            beq.setBatchName(globalenrollbatch.getBatch());
          }
          Branch branch = branchBiz.findBranchById(beq.getBranchId());
          if (branch != null) {
            beq.setBranchName(branch.getName());
          }
        }
      }
    }
    return beq;
  }