示例#1
0
 @Override
 protected AdvQueryString generateCountQuery(ActionForm aform) {
   NpcStockInboundForm form = (NpcStockInboundForm) aform;
   AdvQueryString countQuery = new AdvQueryString();
   String queryString = "select count(nf) from StockInfoForm as nf ";
   ArrayList<QueryParameter> paramList = this.queryCondition(form);
   queryString = queryString + where;
   countQuery.setQueryString(queryString);
   countQuery.setParameters(paramList);
   return countQuery;
 }
示例#2
0
 @Override
 protected AdvQueryString generateListQuery(ActionForm aform) {
   NpcStockInboundForm form = (NpcStockInboundForm) aform;
   AdvQueryString listQuery = new AdvQueryString();
   String queryString = "from StockInfoForm as nf ";
   ArrayList<QueryParameter> paramList = this.queryCondition(form);
   queryString = queryString + where + "	order by nf.updateDate DESC";
   listQuery.setQueryString(queryString);
   listQuery.setParameters(paramList);
   return listQuery;
 }
示例#3
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;
  }
示例#4
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;
  }
示例#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;
  }