Package sk.iway.iwcm.doc
Interface DocHistoryRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DocHistory,,Long> org.springframework.data.jpa.repository.JpaRepository<DocHistory,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<DocHistory>,org.springframework.data.repository.PagingAndSortingRepository<DocHistory,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<DocHistory>,org.springframework.data.repository.Repository<DocHistory,Long>
@Repository
public interface DocHistoryRepository
extends org.springframework.data.jpa.repository.JpaRepository<DocHistory,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<DocHistory>
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByIdPublicable(Long historyId, boolean publicable) voiddeleteHistoryOnPublish(List<Integer> historyIds, int authorId) findByDocIdAndPublishStartDate(Integer docId, Date publishStartDate) findByDocIdInActual(List<Integer> docIds) findGroupIdById(Long id) findMaxHistoryId(int docId) findMaxHistoryId(int docId, boolean actual) findOldHistoryIds(int docId, int historyId) findOldHistoryIds(int docId, Long historyId, boolean publicable, int authorId) getHisotryIdsByDocIdIn(Integer docIds) getPublicableByDocIdIn(Integer docIds) voidrejectDocHistory(String awaitingApprove, Integer disapprovedBy, Integer historyId) voidupdateActual(boolean actual, List<Integer> historyIds) voidupdateActualAndSyncStatus(boolean actual, int[] historyIds) voidupdateActualHistory(boolean actual, String awaitingApprove, List<Integer> historyIds) voidupdateAwaitingApprove(String awaitingApprove, Integer docId) voidupdatePublicableAndActual(boolean publicable, boolean actual, int approvedBy, boolean available, int historyId) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, findAll, findAll, findAll, findOneMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByDocIdAndPublishStartDate
-
findOldHistoryIds
-
deleteHistoryOnPublish
-
deleteByIdPublicable
@Transactional @Modifying @Query("DELETE FROM DocHistory WHERE id = :historyIds AND publicable = :publicable") void deleteByIdPublicable(@Param("historyIds") Long historyId, @Param("publicable") boolean publicable) -
findOldHistoryIds
-
updateActualHistory
@Transactional @Modifying @Query("UPDATE DocHistory SET actual = :actual, awaitingApprove = :awaitingApprove, syncStatus = 1 WHERE id IN :historyIds") void updateActualHistory(@Param("actual") boolean actual, @Param("awaitingApprove") String awaitingApprove, @Param("historyIds") List<Integer> historyIds) -
updateActual
-
rejectDocHistory
@Transactional @Modifying @Query("UPDATE DocHistory SET awaitingApprove = :awaitingApprove, disapprovedBy = :disapprovedBy, syncStatus = 1 WHERE id = :historyId") void rejectDocHistory(@Param("awaitingApprove") String awaitingApprove, @Param("disapprovedBy") Integer disapprovedBy, @Param("historyId") Integer historyId) -
updateAwaitingApprove
-
findMaxHistoryId
-
findMaxHistoryId
@Query(value="SELECT max(history_id) AS max FROM documents_history WHERE doc_id=?", nativeQuery=true) Integer findMaxHistoryId(int docId) -
findGroupIdById
-
findByDocIdInActual
@Query("SELECT dh FROM DocHistory dh WHERE dh.docId IN :docIds AND dh.actual = 1") List<DocHistory> findByDocIdInActual(@Param("docIds") List<Integer> docIds) -
findTopByDocIdOrderBySaveDateDesc
-
updateActualAndSyncStatus
@Transactional @Modifying @Query("UPDATE DocHistory dh SET dh.actual = :actual, dh.syncStatus = 1 WHERE dh.id IN :historyIds") void updateActualAndSyncStatus(@Param("actual") boolean actual, @Param("historyIds") int[] historyIds) -
updatePublicableAndActual
@Transactional @Modifying @Query("UPDATE DocHistory dh SET dh.publicable = :publicable, dh.actual = :actual, dh.approvedBy = :approvedBy, dh.syncStatus = 1, dh.available = :available WHERE dh.id = :historyId") void updatePublicableAndActual(@Param("publicable") boolean publicable, @Param("actual") boolean actual, @Param("approvedBy") int approvedBy, @Param("available") boolean available, @Param("historyId") int historyId) -
getPublicableByDocIdIn
-
getHisotryIdsByDocIdIn
-
getPublicableThatAreNotAwaitingToApprove
@Query("SELECT dh FROM DocHistory dh WHERE dh.publicable = true AND ( dh.awaitingApprove IS NULL OR dh.awaitingApprove = \'\' ) AND dh.publishStartDate IS NOT NULL") Optional<List<DocHistory>> getPublicableThatAreNotAwaitingToApprove()
-