mirror of https://github.com/halo-dev/halo
fix: post query sql. (#676)
parent
4d431fd85d
commit
fae1df3859
|
@ -45,7 +45,7 @@ public interface PostRepository extends BasePostRepository<Post>, JpaSpecificati
|
|||
* @param slug post slug
|
||||
* @return a optional of post
|
||||
*/
|
||||
@Query("select post from Post post where DateUtil.year(post.createTime) = :year and DateUtil.month(post.createTime) = :month and post.slug = :slug")
|
||||
@Query("select post from Post post where year(post.createTime) = :year and month(post.createTime) = :month and post.slug = :slug")
|
||||
Optional<Post> findBy(@Param("year") Integer year, @Param("month") Integer month, @Param("slug") String slug);
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ public interface PostRepository extends BasePostRepository<Post>, JpaSpecificati
|
|||
* @param status post status
|
||||
* @return a optional of post
|
||||
*/
|
||||
@Query("select post from Post post where DateUtil.year(post.createTime) = :year and DateUtil.month(post.createTime) = :month and post.slug = :slug and post.status = :status")
|
||||
@Query("select post from Post post where year(post.createTime) = :year and month(post.createTime) = :month and post.slug = :slug and post.status = :status")
|
||||
Optional<Post> findBy(@Param("year") Integer year, @Param("month") Integer month, @Param("slug") String slug, @Param("status") PostStatus status);
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ public interface PostRepository extends BasePostRepository<Post>, JpaSpecificati
|
|||
* @param slug post slug
|
||||
* @return a optional of post
|
||||
*/
|
||||
@Query("select post from Post post where DateUtil.year(post.createTime) = :year and DateUtil.month(post.createTime) = :month and DateUtil.dayOfMonth(post.createTime) = :day and post.slug = :slug")
|
||||
@Query("select post from Post post where year(post.createTime) = :year and month(post.createTime) = :month and day(post.createTime) = :day and post.slug = :slug")
|
||||
Optional<Post> findBy(@Param("year") Integer year, @Param("month") Integer month, @Param("day") Integer day, @Param("slug") String slug);
|
||||
|
||||
/**
|
||||
|
@ -82,6 +82,6 @@ public interface PostRepository extends BasePostRepository<Post>, JpaSpecificati
|
|||
* @param status post status
|
||||
* @return a optional of post
|
||||
*/
|
||||
@Query("select post from Post post where DateUtil.year(post.createTime) = :year and DateUtil.month(post.createTime) = :month and DateUtil.dayOfMonth(post.createTime) = :day and post.slug = :slug and post.status = :status")
|
||||
@Query("select post from Post post where year(post.createTime) = :year and month(post.createTime) = :month and day(post.createTime) = :day and post.slug = :slug and post.status = :status")
|
||||
Optional<Post> findBy(@Param("year") Integer year, @Param("month") Integer month, @Param("day") Integer day, @Param("slug") String slug, @Param("status") PostStatus status);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue