Exemplo n.º 1
0
  /**
   * @Description: 组织sql
   *
   * @param note
   * @return:void
   */
  private String genSql(Note note) {
    // 组装sql
    StringBuilder sb = new StringBuilder();
    sb.append(" update tcnote  set ");

    if (note.getAuthorName() != null) {
      sb.append(" author_name='" + note.getAuthorName() + "', ");
    }
    if (note.getFromUrl() != null) {
      sb.append(" from_Url='" + note.getFromUrl() + "', ");
    }
    if (note.getNoteName() != null) {
      sb.append(" note_name='" + note.getNoteName() + "', ");
    }
    // flag=0防止note里面字段都是空的
    sb.append(" flag=0 where note_id= " + note.getNoteId());

    return sb.toString();
  }
Exemplo 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();
 }