Ejemplo n.º 1
0
  /**
   * @Description: 组装key值
   *
   * @param note
   * @return:void
   */
  private String[] genKeys(Note note) {
    String[] string = null;
    StringBuilder sb = new StringBuilder();

    if (note.getAuthorName() != null) {
      sb.append("," + "Note:authorName:" + note.getAuthorName());
    }
    if (note.getFromUrl() != null) {
      sb.append("," + "Note:fromUrl:" + note.getFromUrl() + ",");
    }
    if (note.getFlag() != null) {
      sb.append("," + "Note:flag:" + note.getFlag() + ",");
    }

    if (null != sb.toString()) {
      // 去除第一个逗号
      String replaceString = sb.toString().replaceFirst(",", "");
      string = replaceString.split(",");
    }
    return string;
  }
Ejemplo n.º 2
0
 private String insertSql(Note note) {
   // 组装sql
   StringBuilder sb = new StringBuilder();
   sb.append(
       "insert into tcnote (note_id,note_name,author_name,from_url,flag,noteBook,noteBookGroup) values ( ");
   sb.append(note.getNoteId() + ", ");
   sb.append("'" + note.getNoteName() + "', ");
   sb.append("'" + note.getAuthorName() + "', ");
   sb.append("'" + note.getFromUrl() + "', ");
   sb.append(note.getFlag() + ", ");
   sb.append(" 1, ");
   sb.append(" 1 )");
   return sb.toString();
 }