コード例 #1
0
ファイル: WhereVO.java プロジェクト: Jason1989/jeestudio
  public String toWhereString(DataSource dataSource, WhereVO wherevo) throws Exception {
    StringBuffer where = new StringBuffer("");
    if (first.getDataSource() != null) {
      where.append(
          first.getName() + "." + ((FieldDefVO) first.getFieldList().get(0)).getToFieldName());
    } else {
      where.append(first.getName());
    }
    where.append(" " + operate + " ");
    // System.out.println(where.toString());
    if (second.getDataSource() != null) {
      where.append(
          second.getName() + "." + ((FieldDefVO) second.getFieldList().get(0)).getToFieldName());
    } else {
      if (first.getFieldList() != null) {
        if (second.getName().indexOf("$F") >= 0) {
          where.append(second.getName());
        } else {
          where.append(" ? ");
        }

      } else {
        if (second.getName().indexOf("$F") >= 0) {
          where.append(second.getName());
        } else {
          where.append(new ResolveXmlService().changeType(first.getDataType(), second.getName()));
        }
        if (second.getType().equals("PARAM")) {}
      }
    }
    // System.out.println(where.toString());
    return where.toString();
  }
コード例 #2
0
ファイル: WhereVO.java プロジェクト: Jason1989/jeestudio
  public String toSecondString(DataSource dataSource) throws Exception {
    StringBuffer where = new StringBuffer("");
    String name = null;
    if (second.getDataSource() != null) {
      where.append(
          second.getName() + "." + ((FieldDefVO) second.getFieldList().get(0)).getToFieldName());
    } else {
      if (first.getFieldList() != null) {
        name = second.getName();
        if (second.getName().indexOf("$F") >= 0) {
          where.append(name);
        } else {
          if (second.getType().equals("VALUE")) {
            name = name.replaceAll("\'", "\'\'");
            where.append(
                new ResolveXmlService()
                    .changeValueType(
                        ((FieldDefVO) first.getFieldList().get(0)).getToFieldType(), name));
          } else {
            where.append(
                new ResolveXmlService()
                    .changeOtherType(
                        ((FieldDefVO) first.getFieldList().get(0)).getToFieldType(), name));
          }
        }
      } else {
        String secondName = second.getName();
        if (second.getName().indexOf("$F") >= 0) {
          where.append(secondName);
        } else {
          if (second.getType().equals("VALUE")) {
            secondName = name.replaceAll("\'", "\'\'");
            where.append(new ResolveXmlService().changeValueType(first.getDataType(), secondName));
          } else if (second.getType().equals("PARAM")) {
            where.append("?");
          } else {
            where.append(new ResolveXmlService().changeOtherType(first.getDataType(), secondName));
          }
        }
      }
    }

    return where.toString();
  }