Esempio n. 1
0
 public String forModelDeleteById(TableInfo tInfo) {
   String primaryKey = tInfo.getPrimaryKey();
   StringBuilder sql = new StringBuilder(45);
   sql.append("delete from \"");
   sql.append(tInfo.getTableName());
   sql.append("\" where \"").append(primaryKey).append("\" = ?");
   return sql.toString();
 }
Esempio n. 2
0
 public String forModelFindById(TableInfo tInfo, String columns) {
   StringBuilder sql = new StringBuilder("select ");
   if (columns.trim().equals("*")) {
     sql.append(columns);
   } else {
     String[] columnsArray = columns.split(",");
     for (int i = 0; i < columnsArray.length; i++) {
       if (i > 0) sql.append(", ");
       sql.append("\"").append(columnsArray[i].trim()).append("\"");
     }
   }
   sql.append(" from \"");
   sql.append(tInfo.getTableName());
   sql.append("\" where \"").append(tInfo.getPrimaryKey()).append("\" = ?");
   return sql.toString();
 }