Notes
Repository
The NotesRepository
interface is
useful to manage the queries for the notes
Author
N7ghtm4r3 - Tecknobit
See also
JpaRepository
Functions
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "INSERT INTO " + NOTES_KEY
+ " (" + IDENTIFIER_KEY + ","
+ AUTHOR_KEY + ","
+ CONTENT_NOTE_KEY + ","
+ CREATION_DATE_KEY + ","
+ MARKED_AS_DONE_KEY + ","
+ MARKED_AS_DONE_BY_KEY + ","
+ MARKED_AS_DONE_DATE_KEY + ","
+ UPDATE_KEY + ") "
+ "VALUES ("
+ ":" + IDENTIFIER_KEY + ","
+ ":" + AUTHOR_KEY + ","
+ ":" + CONTENT_NOTE_KEY + ","
+ ":" + CREATION_DATE_KEY + ","
+ "false,"
+ "NULL,"
+ "-1,"
+ ":" + UPDATE_KEY
+ ")",
nativeQuery = true
)
Method to execute the query to add a new
change note
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "INSERT INTO " + NOTES_KEY
+ " (" + IDENTIFIER_KEY + ","
+ AUTHOR_KEY + ","
+ CONTENT_NOTE_KEY + ","
+ CREATION_DATE_KEY + ","
+ MARKED_AS_DONE_KEY + ","
+ MARKED_AS_DONE_BY_KEY + ","
+ MARKED_AS_DONE_DATE_KEY + ")"
+ "VALUES ("
+ ":" + IDENTIFIER_KEY + ","
+ ":" + AUTHOR_KEY + ","
+ ":" + CONTENT_NOTE_KEY + ","
+ ":" + CREATION_DATE_KEY + ","
+ "false,"
+ "NULL,"
+ "-1"
+ ")",
nativeQuery = true
)
Method to execute the query to create a new
Note
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + UPDATE_KEY + "=:" + UPDATE_KEY",
nativeQuery = true
)
Method to execute the query to delete a
change note
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to delete a Note
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + NOTES_KEY + " SET " +
CONTENT_NOTE_KEY + "=:" + CONTENT_NOTE_KEY +
" WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY +
" AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to edit an
existing Note
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Query(value = ""SELECT * FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to select a Note
by its id
Link copied to clipboard
@Query(value = ""SELECT * FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + UPDATE_KEY + "=:" + UPDATE_KEY",
nativeQuery = true
)
Method to execute the query to select a Note
of an ProjectUpdate
Link copied to clipboard
@Query(value = "SELECT * FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY
+ " AND " + UPDATE_KEY + " IS NULL ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
@Query(value = "SELECT * FROM " + NOTES_KEY +
" WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + UPDATE_KEY + " IS NULL" +
" AND " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Note
Link copied to clipboard
@Query(value = "SELECT COUNT(*) FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + UPDATE_KEY + " IS NULL",
nativeQuery = true
)
@Query(value = "SELECT COUNT(*) FROM " + NOTES_KEY +
" WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY +
" AND " + UPDATE_KEY + " IS NULL",
nativeQuery = true
)
Method to execute the query to select the
number of the notes
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + NOTES_KEY + " SET "
+ MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + ","
+ MARKED_AS_DONE_BY_KEY + "=:" + MARKED_AS_DONE_BY_KEY + ","
+ MARKED_AS_DONE_DATE_KEY + "=:" + MARKED_AS_DONE_DATE_KEY
+ " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND "
+ UPDATE_KEY + "=:" + UPDATE_KEY",
nativeQuery = true
)
Method to execute the query to manage the
status of a change note
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + NOTES_KEY + " SET "
+ MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + ","
+ MARKED_AS_DONE_BY_KEY + "= NULL,"
+ MARKED_AS_DONE_DATE_KEY + "=:" + MARKED_AS_DONE_DATE_KEY
+ " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND "
+ AUTHOR_KEY + "=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to manage the
status of a Note
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "DELETE FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + UPDATE_KEY + " IS NULL",
nativeQuery = true
)
Method to execute the query to remove the
constraints between PandoroUser
deleted and Note
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "UPDATE " + NOTES_KEY + " SET "
+ AUTHOR_KEY + "= NULL"
+ " WHERE " + AUTHOR_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + UPDATE_KEY + " IS NOT NULL",
nativeQuery = true
)
Method to execute the query to remove the
constraints between PandoroUser
deleted and the author of the Note
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "UPDATE " + NOTES_KEY + " SET "
+ MARKED_AS_DONE_BY_KEY + "= NULL"
+ " WHERE " + MARKED_AS_DONE_BY_KEY + "=:" + IDENTIFIER_KEY
+ " AND " + UPDATE_KEY + " IS NOT NULL",
nativeQuery = true
)
Method to execute the query to remove the
constraints between PandoroUser
deleted and the marker of the Note