Package com.share.core.pojos.system

Examples of com.share.core.pojos.system.SysColumn


    return dao.getJdbcTemplate().query(SQL_LIST, map, new SysColumnMapper());
  }

  protected class SysColumnMapper implements RowMapper {
    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
      SysColumn o = new SysColumn();
      o.setId(rs.getInt("ordinal_position"));
      o.setColumnCode(rs.getString("column_name"));
      o.setColumnName(rs.getString("column_comment"));
      o.setColumnType(rs.getString("data_type"));
      o.setColumnKey(rs.getString("column_key"));

      return o;
    }
View Full Code Here


   */
  public static String getPojosStr(List<SysColumn> sqllist) {
    StringBuffer sb = new StringBuffer();
    for (Iterator iterator = sqllist.iterator(); iterator.hasNext();) {
      // Map<String, Object> map = (Map<String, Object>) iterator.next();
      SysColumn sysColumn = (SysColumn) iterator.next();
      if (sysColumn.getColumnType().equals("int") || sysColumn.getColumnType().equals("smallint")) {
        sb.append("private int ").append(sysColumn.getColumnCode()).append(";").append("\r\n");
      } else if (sysColumn.getColumnType().equals("varchar") || sysColumn.getColumnType().equals("text")) {
        sb.append("private String ").append(sysColumn.getColumnCode()).append(";").append("\r\n");
      } else if (sysColumn.getColumnType().equals("timestamp")) {
        sb.append("private Date ").append(sysColumn.getColumnCode()).append(";").append("\r\n");
      } else if (sysColumn.getColumnType().equals("number") || sysColumn.getColumnType().equals("double")) {
        sb.append("private double ").append(sysColumn.getColumnCode()).append(";").append("\r\n");
      }
    }
    // System.out.println(sb);
    return sb.toString();
  }
View Full Code Here

   *
   */
  public static String getPojosMethod(List<SysColumn> sqllist) {
    StringBuffer sb = new StringBuffer();
    for (Iterator iterator = sqllist.iterator(); iterator.hasNext();) {
      SysColumn sysColumn = (SysColumn) iterator.next();
      sb.append("public ");
      if (sysColumn.getColumnType().equals("int") || sysColumn.getColumnType().equals("smallint")) {
        sb.append("int");
      } else if (sysColumn.getColumnType().equals("varchar") || sysColumn.getColumnType().equals("text")) {
        sb.append("String");
      } else if (sysColumn.getColumnType().equals("timestamp")) {
        sb.append("Date");
      } else if (sysColumn.getColumnType().equals("number") || sysColumn.getColumnType().equals("double")) {
        sb.append("double");
      }
      sb.append(" get").append(sysColumn.getColumnCode().toString().substring(0, 1).toUpperCase())
          .append(sysColumn.getColumnCode().toString().substring(1)).append("() {").append("\r\n");
      sb.append("return ").append(sysColumn.getColumnCode()).append(";\r\n");
      sb.append("}\r\n\r\n");
      sb.append("public void set").append(sysColumn.getColumnCode().toString().substring(0, 1).toUpperCase())
          .append(sysColumn.getColumnCode().toString().substring(1)).append("(");
      if (sysColumn.getColumnType().equals("int") || sysColumn.getColumnType().equals("smallint")) {
        sb.append("int ");
      } else if (sysColumn.getColumnType().equals("varchar") || sysColumn.getColumnType().equals("text")) {
        sb.append("String ");
      } else if (sysColumn.getColumnType().equals("timestamp")) {
        sb.append("Date ");
      } else if (sysColumn.getColumnType().equals("number") || sysColumn.getColumnType().equals("double")) {
        sb.append("double ");
      }
      sb.append(sysColumn.getColumnCode()).append(") {").append("\r\n");
      sb.append("this.").append(sysColumn.getColumnCode()).append(" = ").append(sysColumn.getColumnCode()).append(";\r\n");
      sb.append("}").append("\r\n").append("\r\n");
    }
    // System.out.println(sb.toString());
    return sb.toString();
  }
View Full Code Here

    StringBuffer temp = new StringBuffer();
    temp.append(" values(");
    int i = 0;
    for (Iterator iterator = sqllist.iterator(); iterator.hasNext();) {
      // Map<String, Object> map = (Map<String, Object>) iterator.next();
      SysColumn sysColumn = (SysColumn) iterator.next();
      sb.append(sysColumn.getColumnCode());
      if (!sysColumn.getColumnKey().equals("PRI")) {
        temp.append(":").append(sysColumn.getColumnCode());
      } else {
        temp.append(0);
      }
      i++;
      if (i < sqllist.size()) {
View Full Code Here

    sb.append("update ").append(tablename).append(" set ");
    int i = 0;
    StringBuffer wheresqlSb = new StringBuffer();
    for (Iterator iterator = sqllist.iterator(); iterator.hasNext();) {
      // Map<String, Object> map = (Map<String, Object>) iterator.next();
      SysColumn sysColumn = (SysColumn) iterator.next();
      if (!sysColumn.getColumnKey().equals("PRI")) {
        sb.append(sysColumn.getColumnCode()).append("=:").append(sysColumn.getColumnCode());
      } else {
        wheresqlSb.append(" where ").append(sysColumn.getColumnCode()).append("=").append(":").append(sysColumn.getColumnCode());
      }
      i++;
      if (i < sqllist.size() && i > 1) {
        sb.append(",");
      }
View Full Code Here

  public static String getDaoRowMapper(List<SysColumn> sqllist) {
    StringBuffer sb = new StringBuffer();
    for (Iterator iterator = sqllist.iterator(); iterator.hasNext();) {
      StringBuffer columnSb = new StringBuffer();
      // Map<String, Object> map = (Map<String, Object>) iterator.next();
      SysColumn sysColumn = (SysColumn) iterator.next();
      columnSb.append(sysColumn.getColumnCode().toString().substring(0, 1).toUpperCase()).append(
          sysColumn.getColumnCode().toString().substring(1));
      sb.append("o.set").append(columnSb).append("(rs.get");
      if (sysColumn.getColumnType().equals("int") || sysColumn.getColumnType().equals("smallint")) {
        sb.append("Int(\"");
      } else if (sysColumn.getColumnType().equals("varchar") || sysColumn.getColumnType().equals("text") || sysColumn.getColumnType().equals("char")) {
        sb.append("String(\"");
      } else if (sysColumn.getColumnType().equals("timestamp")) {
        sb.append("Timestamp(\"");
      } else if (sysColumn.getColumnType().equals("number")) {
        sb.append("Double(\"");
      }
      sb.append(sysColumn.getColumnCode()).append("\"));\r\n");
    }
    // System.out.println("sb:" + sb);
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of com.share.core.pojos.system.SysColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.