예제 #1
0
  /**
   * Generate HQL sentence for querying result
   *
   * @param aform ActionForm Combined query conditions
   * @return String Combined query sentence
   */
  protected AdvQueryString generateListQuery(ActionForm aform) {
    StockInfoForm form = (StockInfoForm) aform;
    AdvQueryString listQuery = new AdvQueryString();

    String queryString = "from StockInfoForm as pa ";

    ArrayList paramList = this.queryCondition(form);

    queryString = queryString + where + " order by FLOW_NO ,CREATE_DATE ";

    listQuery.setQueryString(queryString);
    listQuery.setParameters(paramList);

    return listQuery;
  }
예제 #2
0
  /**
   * Generate HQL sentence for querying results quantity
   *
   * @param aform ActionForm Combined query conditions
   * @return String Combined query sentence
   */
  protected AdvQueryString generateCountQuery(ActionForm aform) {
    StockInfoForm form = (StockInfoForm) aform;
    AdvQueryString countQuery = new AdvQueryString();

    String queryString = "select count(pa) from StockInfoForm as pa ";

    ArrayList paramList = this.queryCondition(form);

    queryString = queryString + where + "  ";

    countQuery.setQueryString(queryString);
    countQuery.setParameters(paramList);

    return countQuery;
  }
예제 #3
0
  /**
   * @todo Implement this ces.architect.util.QueryBean method
   * @param actionform ActionForm
   * @return AdvQueryString
   */
  protected AdvQueryString generateCountQuery(ActionForm aform) {
    SaleDetailForm form = (SaleDetailForm) aform;
    AdvQueryString countQuery = new AdvQueryString();

    String queryString =
        "select count(distinct pa.saleDetailId) from SaleDetailForm as pa,StockInfoForm as sif ";

    ArrayList paramList = this.queryCondition(form);

    queryString = queryString + where;

    countQuery.setQueryString(queryString);
    countQuery.setParameters(paramList);

    return countQuery;
  }
예제 #4
0
  /**
   * @todo Implement this ces.architect.util.QueryBean method
   * @param actionform ActionForm
   * @return AdvQueryString
   */
  protected AdvQueryString generateListQuery(ActionForm aform) {
    SaleDetailForm form = (SaleDetailForm) aform;
    AdvQueryString listQuery = new AdvQueryString();

    String queryString =
        "select distinct pa.saleDetailId,pa.saleNo,pa.stuffNo,pa.skuCode,"
            + "pa.skuUnit,pa.partNum,pa.modelCode,pa.modelSerialNo,pa.salePerPrice,"
            + "(sif.skuNum),pa.createBy,pa.createDate,pa.version "
            + "from SaleDetailForm as pa,StockInfoForm as sif ";

    ArrayList paramList = this.queryCondition(form);

    queryString = queryString + where + " order by pa.saleNo,pa.stuffNo ";

    listQuery.setQueryString(queryString);
    listQuery.setParameters(paramList);

    return listQuery;
  }
예제 #5
0
  /**
   * Generate HQL sentence for querying results quantity
   *
   * @param aform ActionForm
   * @return AdvQueryString
   */
  protected AdvQueryString generateCountQuery(ActionForm aform) {
    TsRepairLevelForm form = (TsRepairLevelForm) aform;
    AdvQueryString countQuery = new AdvQueryString();
    ArrayList paramList = new ArrayList();
    String queryString = "select count(pa) from TsRepairLevelForm as pa  ";
    String where = " where 1=1 ";
    if (form != null) {
      if (form.getMethodCode() != null && !form.getMethodCode().equals("")) {
        where = where + " and (pa.methodCode like :methodCode ";
        QueryParameter param = new QueryParameter();
        param.setName("methodCode");
        param.setValue(form.getMethodCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.methodCode like :methodCodeUPCASE";
        param = new QueryParameter();
        param.setName("methodCodeUPCASE");
        param.setValue("%" + form.getMethodCode().toUpperCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.methodCode like :methodCodeLOWERCASE";
        param = new QueryParameter();
        param.setName("methodCodeLOWERCASE");
        param.setValue("%" + form.getMethodCode().toLowerCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
        where += ")";
      }
      if (form.getPartCode() != null && !form.getPartCode().equals("")) {
        where = where + " and (pa.partCode like :partCode ";
        QueryParameter param = new QueryParameter();
        param.setName("partCode");
        param.setValue(form.getPartCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.partCode like :partCodeUPCASE";
        param = new QueryParameter();
        param.setName("partCodeUPCASE");
        param.setValue("%" + form.getPartCode().toUpperCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.partCode like :partCodeLOWERCASE";
        param = new QueryParameter();
        param.setName("partCodeLOWERCASE");
        param.setValue("%" + form.getPartCode().toLowerCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
        where += ")";
      }
      if (form.getBizGroupName() != null && !form.getBizGroupName().equals("")) {
        where = where + " and (pa.bizGroupName like :bizGroupName";
        QueryParameter param = new QueryParameter();
        param.setName("bizGroupName");
        param.setValue(form.getBizGroupName());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.bizGroupName like :bizGroupNameUPCASE";
        param = new QueryParameter();
        param.setName("bizGroupNameUPCASE");
        param.setValue("%" + form.getBizGroupName().toUpperCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.bizGroupName like :bizGroupNameLOWERCASE";
        param = new QueryParameter();
        param.setName("bizGroupNameLOWERCASE");
        param.setValue("%" + form.getBizGroupName().toLowerCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
        where += ")";
      }
      if (form.getRepairType() != null
          && !form.getRepairType().equals("N")
          && !form.getRepairType().equals("")) {
        where = where + " and (pa.repairType = :repairType)";
        QueryParameter param = new QueryParameter();
        param.setName("repairType");
        param.setValue(form.getRepairType());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getRepairProperites() != null
          && !form.getRepairProperites().equals("N")
          && !form.getRepairProperites().equals("")) {
        where = where + " and (pa.repairProperites = :repairProperites)";
        QueryParameter param = new QueryParameter();
        param.setName("repairProperites");
        param.setValue(form.getRepairProperites());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getRepairLevel() != null
          && form.getRepairLevel().longValue() != 0
          && !form.getRepairLevel().equals("")) {
        where = where + " and (pa.repairLevel = :repairLevel) ";
        QueryParameter param = new QueryParameter();
        param.setName("repairLevel");
        param.setValue(form.getRepairLevel());
        param.setHbType(Hibernate.LONG);
        paramList.add(param);
      }
      if (form.getModelCode() != null && !form.getModelCode().equals("")) {
        where = where + " and (pa.modelCode like :modelCode ";
        QueryParameter param = new QueryParameter();
        param.setName("modelCode");
        param.setValue(form.getModelCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.modelCode like :modelCodeUPCASE";
        param = new QueryParameter();
        param.setName("modelCodeUPCASE");
        param.setValue("%" + form.getModelCode().toUpperCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);

        where = where + " or pa.modelCode like :modelCodeLOWERCASE";
        param = new QueryParameter();
        param.setName("modelCodeLOWERCASE");
        param.setValue("%" + form.getModelCode().toLowerCase() + "%");
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
        where += ")";
      }
      if (form.getMajorCat() != null && !"".equals(form.getMajorCat())) {
        where = where + " and (pa.majorCat like :majorCat) ";
        QueryParameter param = new QueryParameter();
        param.setName("majorCat");
        param.setValue(form.getMajorCat());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getMinorCat() != null && !"".equals(form.getMinorCat())) {
        where = where + " and (pa.minorCat like :minorCat) ";
        QueryParameter param = new QueryParameter();
        param.setName("minorCat");
        param.setValue(form.getMinorCat());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
    }
    queryString = queryString + where;

    countQuery.setQueryString(queryString);
    countQuery.setParameters(paramList);

    return countQuery;
  }