mirror of https://github.com/halo-dev/halo
👽 干掉部分bug
parent
a62b9f8df5
commit
3e262390ea
|
@ -33,5 +33,3 @@ nbdist/
|
|||
### VS Code ###
|
||||
*.project
|
||||
*.factorypath
|
||||
|
||||
~/
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@Slf4j
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
log.info("Halo started at http://localhost:8090");
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
log.info("Halo started at http://localhost:8090");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface AttachmentRepository extends JpaRepository<Attachment, Long> {
|
|||
* 查询所有附件,分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
Page<Attachment> findAll(Pageable pageable);
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface CategoryRepository extends JpaRepository<Category, Long> {
|
|||
* 根据分类目录路径查询,用于验证是否已经存在该路径
|
||||
*
|
||||
* @param cateUrl cateUrl 文章url
|
||||
* @return category
|
||||
* @return Category
|
||||
*/
|
||||
Category findCategoryByCateUrl(String cateUrl);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
|
|||
*
|
||||
* @param status 文章状态
|
||||
* @param pageable 分页信息
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findCommentsByCommentStatus(Integer status, Pageable pageable);
|
||||
|
||||
|
@ -32,7 +32,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
|
|||
* 根据评论状态查询所有评论 不分页
|
||||
*
|
||||
* @param status 文章状态
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Comment> findCommentsByCommentStatus(Integer status);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
|
|||
*
|
||||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findCommentsByPost(Post post, Pageable pageable);
|
||||
|
||||
|
@ -51,14 +51,14 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
|
|||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @param status status
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status);
|
||||
|
||||
/**
|
||||
* 查询最新的前五条评论
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "SELECT * FROM halo_comment ORDER BY comment_date DESC LIMIT 5", nativeQuery = true)
|
||||
List<Comment> findTopFive();
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface LogsRepository extends JpaRepository<Logs, Long> {
|
|||
/**
|
||||
* 查询最新的五条数据
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "SELECT * FROM halo_logs ORDER BY log_created DESC LIMIT 5", nativeQuery = true)
|
||||
List<Logs> findTopFive();
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface OptionsRepository extends JpaRepository<Options, Long> {
|
|||
* 根据key查询单个option
|
||||
*
|
||||
* @param key key
|
||||
* @return String
|
||||
* @return Options
|
||||
*/
|
||||
Options findOptionsByOptionName(String key);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
/**
|
||||
* 查询前五条文章
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "SELECT * FROM halo_post where post_type='post' ORDER BY post_date DESC LIMIT 5", nativeQuery = true)
|
||||
List<Post> findTopFive();
|
||||
|
@ -34,7 +34,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* 查询所有文章 根据文章类型
|
||||
*
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostsByPostType(String postType);
|
||||
|
||||
|
@ -43,7 +43,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
*
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostsByPostType(String postType, Pageable pageable);
|
||||
|
||||
|
@ -52,7 +52,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
*
|
||||
* @param keyWord keyword
|
||||
* @param pageable pageable
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findByPostTitleLike(String keyWord, Pageable pageable);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostsByPostStatusAndPostType(Integer status, String postType, Pageable pageable);
|
||||
|
||||
|
@ -71,7 +71,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
*
|
||||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostsByPostStatusAndPostType(Integer status, String postType);
|
||||
|
||||
|
@ -90,7 +90,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* @param postDate 发布时间
|
||||
* @param postStatus 0,1,2
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findByPostDateAfterAndPostStatusAndPostTypeOrderByPostDateDesc(Date postDate, Integer postStatus, String postType);
|
||||
|
||||
|
@ -101,14 +101,14 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* @param postDate 发布时间
|
||||
* @param postStatus 0,1,2
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findByPostDateBeforeAndPostStatusAndPostTypeOrderByPostDateAsc(Date postDate, Integer postStatus, String postType);
|
||||
|
||||
/**
|
||||
* 查询文章归档信息 根据年份和月份
|
||||
*
|
||||
* @return List<Object [ ]></>
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "select year(post_date) as year,month(post_date) as month,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date),month(post_date) order by year desc,month desc", nativeQuery = true)
|
||||
List<Object[]> findPostGroupByYearAndMonth();
|
||||
|
@ -116,7 +116,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
/**
|
||||
* 查询文章归档信息 根据年份
|
||||
*
|
||||
* @return List<Object [ ]></>
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "select year(post_date) as year,count(*) as count from halo_post where post_status=0 and post_type='post' group by year(post_date) order by year desc", nativeQuery = true)
|
||||
List<Object[]> findPostGroupByYear();
|
||||
|
@ -126,7 +126,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
*
|
||||
* @param year year
|
||||
* @param month month
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "select *,year(post_date) as year,month(post_date) as month from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", nativeQuery = true)
|
||||
List<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month);
|
||||
|
@ -135,7 +135,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* 根据年份查询文章
|
||||
*
|
||||
* @param year year
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
@Query(value = "select *,year(post_date) as year from halo_post where post_status=0 and post_type='post' and year(post_date)=:year order by post_date desc", nativeQuery = true)
|
||||
List<Post> findPostByYear(@Param("year") String year);
|
||||
|
@ -146,7 +146,7 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
* @param year year
|
||||
* @param month month
|
||||
* @param pageable pageable
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Query(value = "select * from halo_post where post_status=0 and post_type='post' and year(post_date)=:year and month(post_date)=:month order by post_date desc", countQuery = "select count(*) from halo_post where post_status=0 and year(post_date)=:year and month(post_date)=:month", nativeQuery = true)
|
||||
Page<Post> findPostByYearAndMonth(@Param("year") String year, @Param("month") String month, Pageable pageable);
|
||||
|
@ -156,27 +156,33 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
|||
*
|
||||
* @param category category
|
||||
* @param pageable pageable
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostByCategories(Category category, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 根据标签查询文章
|
||||
* 根据标签查询文章,分页
|
||||
*
|
||||
* @param tag tag
|
||||
* @param pageable pageable
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostsByTags(Tag tag, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 根据标签查询文章
|
||||
*
|
||||
* @param tag tag
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostsByTags(Tag tag);
|
||||
|
||||
/**
|
||||
* 模糊查询文章
|
||||
*
|
||||
* @param postType 文章类型,post or page
|
||||
* @param postStatus 0,1,2
|
||||
* @param keyword 关键词
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Query(value = "select * from halo_post where post_status = 0 and post_type='post' and post_title like '%=:keyword%' or post_content like '%=:keyword%'", nativeQuery = true)
|
||||
Page<Post> findPostByPostTitleLikeOrPostContentLikeAndPostTypeAndPostStatus(String keyword, Pageable pageable);
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface TagRepository extends JpaRepository<Tag, Long> {
|
|||
* 根据标签路径查询,用于验证是否已经存在该路径
|
||||
*
|
||||
* @param tagUrl tagUrl
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
Tag findTagByTagUrl(String tagUrl);
|
||||
|
||||
|
@ -25,7 +25,7 @@ public interface TagRepository extends JpaRepository<Tag, Long> {
|
|||
* 根据标签名称查询
|
||||
*
|
||||
* @param tagName 标签名
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
Tag findTagByTagName(String tagName);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
|||
*
|
||||
* @param userName userName
|
||||
* @param userPass userPass
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
User findByUserNameAndUserPass(String userName, String userPass);
|
||||
|
||||
|
@ -27,7 +27,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
|||
*
|
||||
* @param userEmail userEmail
|
||||
* @param userPass userPass
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
User findByUserEmailAndUserPass(String userEmail, String userPass);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public interface AttachmentService {
|
|||
/**
|
||||
* 查询所有附件信息
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Attachment> findAllAttachments();
|
||||
|
||||
|
@ -32,7 +32,7 @@ public interface AttachmentService {
|
|||
* 查询所有附件,分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Attachment> findAllAttachments(Pageable pageable);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface CommentService {
|
|||
* 删除评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return comment
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Comment> removeByCommentId(Long commentId);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public interface CommentService {
|
|||
*
|
||||
* @param status status
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findAllComments(Integer status, Pageable pageable);
|
||||
|
||||
|
@ -42,14 +42,14 @@ public interface CommentService {
|
|||
* 根据评论状态查询评论
|
||||
*
|
||||
* @param status 评论状态
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Comment> findAllComments(Integer status);
|
||||
|
||||
/**
|
||||
* 查询所有评论,不分页
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Comment> findAllComments();
|
||||
|
||||
|
@ -58,7 +58,7 @@ public interface CommentService {
|
|||
*
|
||||
* @param commentId commentId
|
||||
* @param status status
|
||||
* @return comment
|
||||
* @return Comment
|
||||
*/
|
||||
Comment updateCommentStatus(Long commentId, Integer status);
|
||||
|
||||
|
@ -66,7 +66,7 @@ public interface CommentService {
|
|||
* 根据评论编号查询评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return comment
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Comment> findCommentById(Long commentId);
|
||||
|
||||
|
@ -75,7 +75,7 @@ public interface CommentService {
|
|||
*
|
||||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findCommentsByPost(Post post, Pageable pageable);
|
||||
|
||||
|
@ -85,14 +85,14 @@ public interface CommentService {
|
|||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @param status status
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status);
|
||||
|
||||
/**
|
||||
* 查询最新的前五条评论
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Comment> findCommentsLatest();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public interface GalleryService {
|
|||
* 根据编号删除图片
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return Gallery
|
||||
*/
|
||||
Gallery removeByGalleryId(Long galleryId);
|
||||
|
||||
|
@ -40,14 +41,14 @@ public interface GalleryService {
|
|||
* 查询所有图片 分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Gallery> findAllGalleries(Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有图片 不分页
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Gallery> findAllGalleries();
|
||||
|
||||
|
@ -55,7 +56,7 @@ public interface GalleryService {
|
|||
* 根据编号查询图片信息
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return gallery
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Gallery> findByGalleryId(Long galleryId);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface LogsService {
|
|||
* 保存日志
|
||||
*
|
||||
* @param logs logs
|
||||
* @return logs
|
||||
* @return Logs
|
||||
*/
|
||||
Logs saveByLogs(Logs logs);
|
||||
|
||||
|
@ -37,14 +37,14 @@ public interface LogsService {
|
|||
* 查询所有日志并分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Logs> findAllLogs(Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询最新的五条日志
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Logs> findLogsLatest();
|
||||
|
||||
|
@ -52,7 +52,7 @@ public interface LogsService {
|
|||
* 根据编号查询
|
||||
*
|
||||
* @param logsId logsId
|
||||
* @return logs
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Logs> findLogsByLogsId(Long logsId);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface MenuService {
|
|||
/**
|
||||
* 查询所有菜单
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Menu> findAllMenus();
|
||||
|
||||
|
@ -30,7 +30,7 @@ public interface MenuService {
|
|||
* 删除菜单
|
||||
*
|
||||
* @param menuId menuId
|
||||
* @return menu
|
||||
* @return Menu
|
||||
*/
|
||||
Menu removeByMenuId(Long menuId);
|
||||
|
||||
|
@ -38,7 +38,7 @@ public interface MenuService {
|
|||
* 根据编号查询菜单
|
||||
*
|
||||
* @param menuId menuId
|
||||
* @return Menu
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Menu> findByMenuId(Long menuId);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface OptionsService {
|
|||
/**
|
||||
* 获取所有设置选项
|
||||
*
|
||||
* @return map
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, String> findAllOptions();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public interface PostService {
|
|||
*
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findAllPosts(String postType, Pageable pageable);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public interface PostService {
|
|||
* 获取文章列表 不分页
|
||||
*
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findAllPosts(String postType);
|
||||
|
||||
|
@ -71,7 +71,7 @@ public interface PostService {
|
|||
*
|
||||
* @param keyWord keyword
|
||||
* @param pageable pageable
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Post> searchPosts(String keyWord, Pageable pageable);
|
||||
|
||||
|
@ -81,7 +81,7 @@ public interface PostService {
|
|||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable);
|
||||
|
||||
|
@ -90,7 +90,7 @@ public interface PostService {
|
|||
*
|
||||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostByStatus(Integer status, String postType);
|
||||
|
||||
|
@ -122,7 +122,7 @@ public interface PostService {
|
|||
* 查询Id之后的文章
|
||||
*
|
||||
* @param postDate postDate
|
||||
* @return post
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findByPostDateAfter(Date postDate);
|
||||
|
||||
|
@ -130,7 +130,7 @@ public interface PostService {
|
|||
* 查询Id之前的文章
|
||||
*
|
||||
* @param postDate postDate
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findByPostDateBefore(Date postDate);
|
||||
|
||||
|
@ -144,7 +144,7 @@ public interface PostService {
|
|||
/**
|
||||
* 查询归档信息 根据年份
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Archive> findPostGroupByYear();
|
||||
|
||||
|
@ -153,7 +153,7 @@ public interface PostService {
|
|||
*
|
||||
* @param year year
|
||||
* @param month month
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostByYearAndMonth(String year, String month);
|
||||
|
||||
|
@ -163,7 +163,7 @@ public interface PostService {
|
|||
* @param year year
|
||||
* @param month month
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable);
|
||||
|
||||
|
@ -171,7 +171,7 @@ public interface PostService {
|
|||
* 根据年份查询文章
|
||||
*
|
||||
* @param year year
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Post> findPostByYear(String year);
|
||||
|
||||
|
@ -180,7 +180,7 @@ public interface PostService {
|
|||
*
|
||||
* @param category category
|
||||
* @param pageable pageable
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostByCategories(Category category,Pageable pageable);
|
||||
|
||||
|
@ -189,7 +189,7 @@ public interface PostService {
|
|||
*
|
||||
* @param tag tag
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> findPostsByTags(Tag tag, Pageable pageable);
|
||||
|
||||
|
@ -198,22 +198,30 @@ public interface PostService {
|
|||
*
|
||||
* @param keyword 关键词
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
Page<Post> searchByKeywords(String keyword,Pageable pageable);
|
||||
|
||||
/**
|
||||
* 热门文章
|
||||
*
|
||||
* @return List<Post>
|
||||
* @return List
|
||||
*/
|
||||
List<Post> hotPosts();
|
||||
|
||||
/**
|
||||
* 当前文章的相似文章
|
||||
*
|
||||
* @param post post
|
||||
* @return List
|
||||
*/
|
||||
List<Post> relatedPosts(Post post);
|
||||
|
||||
/**
|
||||
* 生成rss
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
String buildRss(List<Post> posts);
|
||||
|
||||
|
@ -221,7 +229,7 @@ public interface PostService {
|
|||
* 生成sitemap
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
String buildSiteMap(List<Post> posts);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface TagService {
|
|||
/**
|
||||
* 获取所有标签
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Tag> findAllTags();
|
||||
|
||||
|
@ -38,7 +38,7 @@ public interface TagService {
|
|||
* 根据编号查询标签
|
||||
*
|
||||
* @param tagId tagId
|
||||
* @return Link
|
||||
* @return Optional
|
||||
*/
|
||||
Optional<Tag> findByTagId(Long tagId);
|
||||
|
||||
|
@ -46,7 +46,7 @@ public interface TagService {
|
|||
* 根据标签路径查询
|
||||
*
|
||||
* @param tagUrl tagUrl
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
Tag findByTagUrl(String tagUrl);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public interface TagService {
|
|||
* 根据标签名称查询
|
||||
*
|
||||
* @param tagName tagName
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
Tag findTagByTagName(String tagName);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public interface TagService {
|
|||
* 转换标签字符串为实体集合
|
||||
*
|
||||
* @param tagList tagList
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
List<Tag> strListToTagList(String tagList);
|
||||
}
|
||||
|
|
|
@ -31,14 +31,14 @@ public interface UserService {
|
|||
*
|
||||
* @param userEmail userEmail
|
||||
* @param userPass userPass
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
User userLoginByEmail(String userEmail, String userPass);
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
*
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
User findUser();
|
||||
|
||||
|
@ -47,7 +47,7 @@ public interface UserService {
|
|||
*
|
||||
* @param userId userid
|
||||
* @param userPass userpass
|
||||
* @return user
|
||||
* @return User
|
||||
*/
|
||||
User findByUserIdAndUserPass(Long userId, String userPass);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class AttachmentServiceImpl implements AttachmentService {
|
|||
/**
|
||||
* 获取所有附件信息
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Attachment> findAllAttachments() {
|
||||
|
@ -46,7 +46,7 @@ public class AttachmentServiceImpl implements AttachmentService {
|
|||
* 获取所有附件信息 分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Attachment> findAllAttachments(Pageable pageable) {
|
||||
|
@ -57,7 +57,7 @@ public class AttachmentServiceImpl implements AttachmentService {
|
|||
* 根据附件id查询附件
|
||||
*
|
||||
* @param attachId attachId
|
||||
* @return attachment
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Attachment> findByAttachId(Long attachId) {
|
||||
|
@ -68,7 +68,7 @@ public class AttachmentServiceImpl implements AttachmentService {
|
|||
* 根据编号移除附件
|
||||
*
|
||||
* @param attachId attachId
|
||||
* @return attachment
|
||||
* @return Attachment
|
||||
*/
|
||||
@Override
|
||||
public Attachment removeByAttachId(Long attachId) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CategoryServiceImpl implements CategoryService {
|
|||
/**
|
||||
* 查询所有分类目录
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Category> findAllCategories() {
|
||||
|
@ -69,14 +69,13 @@ public class CategoryServiceImpl implements CategoryService {
|
|||
* 根据分类目录路径查询,用于验证是否已经存在该路径
|
||||
*
|
||||
* @param cateUrl cateUrl
|
||||
* @return category
|
||||
* @return Category
|
||||
*/
|
||||
@Override
|
||||
public Category findByCateUrl(String cateUrl) {
|
||||
return categoryRepository.findCategoryByCateUrl(cateUrl);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Category> strListToCateList(List<String> strings) {
|
||||
if (null == strings) {
|
||||
|
|
|
@ -35,7 +35,8 @@ public class CommentServiceImpl implements CommentService {
|
|||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param comment
|
||||
* @param commentId commentId
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Comment> removeByCommentId(Long commentId) {
|
||||
|
@ -48,7 +49,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
* 查询所有的评论,用于后台管理
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Comment> findAllComments(Integer status, Pageable pageable) {
|
||||
|
@ -59,7 +60,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
* 根据评论状态查询评论
|
||||
*
|
||||
* @param status 评论状态
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Comment> findAllComments(Integer status) {
|
||||
|
@ -81,7 +82,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
*
|
||||
* @param commentId commentId
|
||||
* @param status status
|
||||
* @return comment
|
||||
* @return Comment
|
||||
*/
|
||||
@Override
|
||||
public Comment updateCommentStatus(Long commentId, Integer status) {
|
||||
|
@ -94,7 +95,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
* 根据评论编号查询评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return comment
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Comment> findCommentById(Long commentId) {
|
||||
|
@ -106,7 +107,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
*
|
||||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Comment> findCommentsByPost(Post post, Pageable pageable) {
|
||||
|
@ -119,7 +120,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
* @param post post
|
||||
* @param pageable pageable
|
||||
* @param status status
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Comment> findCommentsByPostAndCommentStatus(Post post, Pageable pageable, Integer status) {
|
||||
|
@ -129,7 +130,7 @@ public class CommentServiceImpl implements CommentService {
|
|||
/**
|
||||
* 查询最新的前五条评论
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Comment> findCommentsLatest() {
|
||||
|
|
|
@ -36,6 +36,7 @@ public class GalleryServiceImpl implements GalleryService {
|
|||
* 根据编号删除图片
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return Gallery
|
||||
*/
|
||||
@Override
|
||||
public Gallery removeByGalleryId(Long galleryId) {
|
||||
|
@ -59,7 +60,7 @@ public class GalleryServiceImpl implements GalleryService {
|
|||
* 查询所有图片 分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Gallery> findAllGalleries(Pageable pageable) {
|
||||
|
@ -69,7 +70,7 @@ public class GalleryServiceImpl implements GalleryService {
|
|||
/**
|
||||
* 查询所有图片 不分页
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Gallery> findAllGalleries() {
|
||||
|
@ -80,7 +81,7 @@ public class GalleryServiceImpl implements GalleryService {
|
|||
* 根据编号查询图片信息
|
||||
*
|
||||
* @param galleryId galleryId
|
||||
* @return gallery
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Gallery> findByGalleryId(Long galleryId) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class LinkServiceImpl implements LinkService {
|
|||
* 移除友情链接
|
||||
*
|
||||
* @param linkId linkId
|
||||
* @return link
|
||||
* @return Link
|
||||
*/
|
||||
@Override
|
||||
public Link removeByLinkId(Long linkId) {
|
||||
|
@ -46,7 +46,7 @@ public class LinkServiceImpl implements LinkService {
|
|||
/**
|
||||
* 查询所有友情链接
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Link> findAllLinks() {
|
||||
|
@ -57,7 +57,7 @@ public class LinkServiceImpl implements LinkService {
|
|||
* 根据编号查询友情链接
|
||||
*
|
||||
* @param linkId linkId
|
||||
* @return Link
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Link> findByLinkId(Long linkId) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public class LogsServiceImpl implements LogsService {
|
|||
* 保存日志
|
||||
*
|
||||
* @param logs logs
|
||||
* @return logs
|
||||
* @return Logs
|
||||
*/
|
||||
@Override
|
||||
public Logs saveByLogs(Logs logs) {
|
||||
|
@ -55,7 +55,7 @@ public class LogsServiceImpl implements LogsService {
|
|||
* 查询所有日志并分页
|
||||
*
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Logs> findAllLogs(Pageable pageable) {
|
||||
|
@ -65,7 +65,7 @@ public class LogsServiceImpl implements LogsService {
|
|||
/**
|
||||
* 查询最新的五条日志
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Logs> findLogsLatest() {
|
||||
|
@ -76,7 +76,7 @@ public class LogsServiceImpl implements LogsService {
|
|||
* 根据编号查询
|
||||
*
|
||||
* @param logsId logsId
|
||||
* @return logs
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Logs> findLogsByLogsId(Long logsId) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
/**
|
||||
* 查询所有菜单
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Menu> findAllMenus() {
|
||||
|
@ -44,7 +44,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
* 删除菜单
|
||||
*
|
||||
* @param menuId menuId
|
||||
* @return menu
|
||||
* @return Menu
|
||||
*/
|
||||
@Override
|
||||
public Menu removeByMenuId(Long menuId) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class OptionsServiceImpl implements OptionsService {
|
|||
/**
|
||||
* 获取设置选项
|
||||
*
|
||||
* @return map
|
||||
* @return Map
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> findAllOptions() {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> findAllPosts(String postType, Pageable pageable) {
|
||||
|
@ -102,7 +102,7 @@ public class PostServiceImpl implements PostService {
|
|||
* 获取文章列表 不分页
|
||||
*
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findAllPosts(String postType) {
|
||||
|
@ -114,7 +114,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param keyWord keyword
|
||||
* @param pageable pageable
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> searchPosts(String keyWord, Pageable pageable) {
|
||||
|
@ -127,7 +127,7 @@ public class PostServiceImpl implements PostService {
|
|||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @param pageable 分页信息
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable) {
|
||||
|
@ -139,7 +139,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param status 0,1,2
|
||||
* @param postType post or page
|
||||
* @return List<Post></>
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findPostByStatus(Integer status, String postType) {
|
||||
|
@ -150,7 +150,7 @@ public class PostServiceImpl implements PostService {
|
|||
* 根据编号查询文章
|
||||
*
|
||||
* @param postId postId
|
||||
* @return post
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Post> findByPostId(Long postId) {
|
||||
|
@ -172,7 +172,7 @@ public class PostServiceImpl implements PostService {
|
|||
/**
|
||||
* 查询最新的5篇文章
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findPostLatest() {
|
||||
|
@ -194,7 +194,7 @@ public class PostServiceImpl implements PostService {
|
|||
* 查询Id之前的文章
|
||||
*
|
||||
* @param postDate 发布时间
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findByPostDateBefore(Date postDate) {
|
||||
|
@ -226,7 +226,7 @@ public class PostServiceImpl implements PostService {
|
|||
/**
|
||||
* 查询归档信息 根据年份
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Archive> findPostGroupByYear() {
|
||||
|
@ -248,7 +248,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param year year
|
||||
* @param month month
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findPostByYearAndMonth(String year, String month) {
|
||||
|
@ -259,7 +259,7 @@ public class PostServiceImpl implements PostService {
|
|||
* 根据年份查询文章
|
||||
*
|
||||
* @param year year
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> findPostByYear(String year) {
|
||||
|
@ -272,7 +272,7 @@ public class PostServiceImpl implements PostService {
|
|||
* @param year year year
|
||||
* @param month month month
|
||||
* @param pageable pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable) {
|
||||
|
@ -284,7 +284,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param category category
|
||||
* @param pageable pageable
|
||||
* @return Page<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> findPostByCategories(Category category, Pageable pageable) {
|
||||
|
@ -296,7 +296,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param tag tag
|
||||
* @param pageable pageable
|
||||
* @return page
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> findPostsByTags(Tag tag, Pageable pageable) {
|
||||
|
@ -308,7 +308,7 @@ public class PostServiceImpl implements PostService {
|
|||
*
|
||||
* @param keyword 关键词
|
||||
* @param pageable 分页信息
|
||||
* @return List<Post></>
|
||||
* @return Page
|
||||
*/
|
||||
@Override
|
||||
public Page<Post> searchByKeywords(String keyword,Pageable pageable) {
|
||||
|
@ -318,18 +318,44 @@ public class PostServiceImpl implements PostService {
|
|||
/**
|
||||
* 热门文章
|
||||
*
|
||||
* @return List<Post>
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> hotPosts() {
|
||||
return postRepository.findPostsByPostTypeOrderByPostViewsDesc(HaloConst.POST_TYPE_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前文章的相似文章
|
||||
*
|
||||
* @param post post
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Post> relatedPosts(Post post) {
|
||||
//获取当前文章的所有标签
|
||||
List<Tag> tags = post.getTags();
|
||||
List<Post> tempPosts = new ArrayList<>();
|
||||
for (Tag tag : tags) {
|
||||
tempPosts.addAll(postRepository.findPostsByTags(tag));
|
||||
}
|
||||
//去掉当前的文章
|
||||
tempPosts.remove(post);
|
||||
//去掉重复的文章
|
||||
List<Post> allPosts = new ArrayList<>();
|
||||
for (int i = 0; i < tempPosts.size(); i++) {
|
||||
if (!allPosts.contains(tempPosts.get(i))) {
|
||||
allPosts.add(tempPosts.get(i));
|
||||
}
|
||||
}
|
||||
return allPosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成rss
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String buildRss(List<Post> posts) {
|
||||
|
@ -346,7 +372,7 @@ public class PostServiceImpl implements PostService {
|
|||
* 生成sitemap
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String buildSiteMap(List<Post> posts) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TagServiceImpl implements TagService {
|
|||
/**
|
||||
* 获取所有标签
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Tag> findAllTags() {
|
||||
|
@ -58,7 +58,7 @@ public class TagServiceImpl implements TagService {
|
|||
* 根据编号查询标签
|
||||
*
|
||||
* @param tagId tagId
|
||||
* @return Link
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
public Optional<Tag> findByTagId(Long tagId) {
|
||||
|
@ -69,7 +69,7 @@ public class TagServiceImpl implements TagService {
|
|||
* 根据标签路径查询
|
||||
*
|
||||
* @param tagUrl tagUrl
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
@Override
|
||||
public Tag findByTagUrl(String tagUrl) {
|
||||
|
@ -80,7 +80,7 @@ public class TagServiceImpl implements TagService {
|
|||
* 根据标签名称查询
|
||||
*
|
||||
* @param tagName tagName
|
||||
* @return tag
|
||||
* @return Tag
|
||||
*/
|
||||
@Override
|
||||
public Tag findTagByTagName(String tagName) {
|
||||
|
@ -91,7 +91,7 @@ public class TagServiceImpl implements TagService {
|
|||
* 转换标签字符串为实体集合
|
||||
*
|
||||
* @param tagList tagList
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<Tag> strListToTagList(String tagList) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class UserServiceImpl implements UserService {
|
|||
*
|
||||
* @param userName userName
|
||||
* @param userPass userPass
|
||||
* @return user
|
||||
* @return User
|
||||
*/
|
||||
@Override
|
||||
public User userLoginByName(String userName, String userPass) {
|
||||
|
@ -46,7 +46,7 @@ public class UserServiceImpl implements UserService {
|
|||
*
|
||||
* @param userEmail userEmail
|
||||
* @param userPass userPass
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
@Override
|
||||
public User userLoginByEmail(String userEmail, String userPass) {
|
||||
|
@ -56,7 +56,7 @@ public class UserServiceImpl implements UserService {
|
|||
/**
|
||||
* 查询所有用户
|
||||
*
|
||||
* @return list
|
||||
* @return User
|
||||
*/
|
||||
@Override
|
||||
public User findUser() {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class HaloUtils {
|
|||
* 获取所有附件
|
||||
*
|
||||
* @param filePath filePath
|
||||
* @return Map
|
||||
* @return ArrayList
|
||||
*/
|
||||
public static ArrayList<String> getFiles(String filePath) {
|
||||
try {
|
||||
|
@ -117,7 +117,7 @@ public class HaloUtils {
|
|||
* 获取备份文件信息
|
||||
*
|
||||
* @param dir dir
|
||||
* @return List<BackupDto></>
|
||||
* @return List
|
||||
*/
|
||||
public static List<BackupDto> getBackUps(String dir) {
|
||||
String srcPathStr = System.getProperties().getProperty("user.home") + "/halo/backup/" + dir;
|
||||
|
@ -149,7 +149,7 @@ public class HaloUtils {
|
|||
* 转换文件大小
|
||||
*
|
||||
* @param size size
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
public static String parseSize(long size) {
|
||||
if (size < 1024) {
|
||||
|
@ -196,7 +196,7 @@ public class HaloUtils {
|
|||
/**
|
||||
* 获取所有主题
|
||||
*
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
public static List<Theme> getThemes() {
|
||||
List<Theme> themes = new ArrayList<>();
|
||||
|
@ -235,7 +235,7 @@ public class HaloUtils {
|
|||
* 获取主题下的模板文件名
|
||||
*
|
||||
* @param theme theme
|
||||
* @return list
|
||||
* @return List
|
||||
*/
|
||||
public static List<String> getTplName(String theme) {
|
||||
List<String> tpls = new ArrayList<>();
|
||||
|
@ -271,7 +271,7 @@ public class HaloUtils {
|
|||
* 获取文件内容
|
||||
*
|
||||
* @param filePath filePath
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
public static String getFileContent(String filePath) {
|
||||
File file = new File(filePath);
|
||||
|
@ -384,7 +384,7 @@ public class HaloUtils {
|
|||
* 生成rss
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
* @throws FeedException
|
||||
*/
|
||||
public static String getRss(List<Post> posts) throws FeedException {
|
||||
|
@ -435,7 +435,7 @@ public class HaloUtils {
|
|||
* 获取sitemap
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
public static String getSiteMap(List<Post> posts) {
|
||||
String head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">";
|
||||
|
@ -466,7 +466,7 @@ public class HaloUtils {
|
|||
* 访问路径获取json数据
|
||||
*
|
||||
* @param enterUrl 路径
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
public static String getHttpResponse(String enterUrl) {
|
||||
BufferedReader in = null;
|
||||
|
@ -507,7 +507,7 @@ public class HaloUtils {
|
|||
* @param blogUrl 博客地址
|
||||
* @param token 百度推送token
|
||||
* @param urls 文章路径
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
public static String baiduPost(String blogUrl, String token, String urls) {
|
||||
String url = "http://data.zz.baidu.com/urls?site=" + blogUrl + "&token=" + token;
|
||||
|
|
|
@ -11,7 +11,6 @@ import cc.ryanc.halo.service.CommentService;
|
|||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
|
|
@ -31,7 +31,10 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
@ -101,7 +104,7 @@ public class AttachmentController {
|
|||
*
|
||||
* @param file file
|
||||
* @param request request
|
||||
* @return Map<String , Object></>
|
||||
* @return Map
|
||||
*/
|
||||
@PostMapping(value = "/upload", produces = {"application/json;charset=UTF-8"})
|
||||
@ResponseBody
|
||||
|
@ -115,7 +118,7 @@ public class AttachmentController {
|
|||
*
|
||||
* @param file file
|
||||
* @param request request
|
||||
* @return Map<String , Object></>
|
||||
* @return Map
|
||||
*/
|
||||
@PostMapping(value = "/upload/editor", produces = {"application/json;charset=UTF-8"})
|
||||
@ResponseBody
|
||||
|
@ -130,7 +133,7 @@ public class AttachmentController {
|
|||
*
|
||||
* @param file file
|
||||
* @param request request
|
||||
* @return Map<String , Object></>
|
||||
* @return Map
|
||||
*/
|
||||
private Map<String, Object> uploadAttachment(MultipartFile file, HttpServletRequest request) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
|
|
@ -8,7 +8,6 @@ import cc.ryanc.halo.service.GalleryService;
|
|||
import cc.ryanc.halo.service.LinkService;
|
||||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -25,7 +24,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
@ -157,6 +157,10 @@ public class PostController extends BaseController {
|
|||
public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) {
|
||||
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
||||
String msg = "发表成功";
|
||||
//判断文章路径是否已经存在
|
||||
if (null != postService.findByPostUrl(post.getPostUrl(), HaloConst.POST_TYPE_POST)) {
|
||||
return new JsonResult(0, "该文章路径已存在!");
|
||||
}
|
||||
try {
|
||||
//提取摘要
|
||||
int postSummary = 50;
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.websocket.server.PathParam;
|
|||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +63,7 @@ public class ThemeController extends BaseController {
|
|||
*
|
||||
* @param siteTheme 主题名称
|
||||
* @param request request
|
||||
* @return true:激活成功,false:激活失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@GetMapping(value = "/set")
|
||||
@ResponseBody
|
||||
|
@ -91,7 +90,7 @@ public class ThemeController extends BaseController {
|
|||
* 上传主题
|
||||
*
|
||||
* @param file 文件
|
||||
* @return boolean true:上传成功,false:上传失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
|
@ -193,7 +192,7 @@ public class ThemeController extends BaseController {
|
|||
*
|
||||
* @param tplName 模板名称
|
||||
* @param tplContent 模板内容
|
||||
* @return boolean true:修改成功,false:修改失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@PostMapping(value = "/editor/save")
|
||||
@ResponseBody
|
||||
|
|
|
@ -42,7 +42,7 @@ public class UserController {
|
|||
*
|
||||
* @param user user
|
||||
* @param session session
|
||||
* @return true:修改成功,false:修改失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
|
@ -69,7 +69,7 @@ public class UserController {
|
|||
* @param newPass 新密码
|
||||
* @param userId 用户编号
|
||||
* @param session session
|
||||
* @return true:修改密码成功,false:修改密码失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@PostMapping(value = "changePass")
|
||||
@ResponseBody
|
||||
|
|
|
@ -4,7 +4,10 @@ import cc.ryanc.halo.model.domain.Category;
|
|||
import cc.ryanc.halo.model.dto.JsonResult;
|
||||
import cc.ryanc.halo.service.CategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class CommonController implements ErrorController {
|
|||
* 渲染404,500
|
||||
*
|
||||
* @param request request
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = ERROR_PATH)
|
||||
public String handleError(HttpServletRequest request) {
|
||||
|
@ -39,7 +39,7 @@ public class CommonController implements ErrorController {
|
|||
* 渲染404页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = "/404")
|
||||
public String fourZeroFour(Model model) {
|
||||
|
@ -52,7 +52,7 @@ public class CommonController implements ErrorController {
|
|||
* 渲染500页面
|
||||
*
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = "/500")
|
||||
public String fiveZeroZero(Model model) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.springframework.ui.Model;
|
|||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
|
@ -34,6 +34,12 @@ public class FrontCategoryController extends BaseController {
|
|||
@Autowired
|
||||
private PostService postService;
|
||||
|
||||
/**
|
||||
* 分类列表页面
|
||||
*
|
||||
* @param model model
|
||||
* @return String
|
||||
*/
|
||||
public String categories(Model model) {
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
model.addAttribute("categories", categories);
|
||||
|
@ -59,7 +65,7 @@ public class FrontCategoryController extends BaseController {
|
|||
* @param model model
|
||||
* @param cateUrl 分类目录路径
|
||||
* @param page 页码
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping("{cateUrl}/page/{page}")
|
||||
public String categories(Model model,
|
||||
|
|
|
@ -8,7 +8,6 @@ import cc.ryanc.halo.service.CommentService;
|
|||
import cc.ryanc.halo.service.MailService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
|
@ -24,7 +23,10 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -52,7 +54,7 @@ public class FrontCommentController {
|
|||
* 获取文章的评论
|
||||
*
|
||||
* @param postId postId 文章编号
|
||||
* @return List<Comment>集合</>
|
||||
* @return List
|
||||
*/
|
||||
@GetMapping(value = "/getComment/{postId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@ResponseBody
|
||||
|
@ -72,7 +74,7 @@ public class FrontCommentController {
|
|||
*
|
||||
* @param page 页码
|
||||
* @param post 当前文章
|
||||
* @return List<Comment></>
|
||||
* @return List
|
||||
*/
|
||||
@GetMapping(value = "/loadComment")
|
||||
@ResponseBody
|
||||
|
@ -90,7 +92,7 @@ public class FrontCommentController {
|
|||
* @param comment comment实体
|
||||
* @param post post实体
|
||||
* @param request request
|
||||
* @return true:评论成功,false:评论失败
|
||||
* @return JsonResult
|
||||
*/
|
||||
@PostMapping(value = "/newComment")
|
||||
@ResponseBody
|
||||
|
|
|
@ -78,7 +78,7 @@ public class FrontIndexController extends BaseController {
|
|||
* ajax分页
|
||||
*
|
||||
* @param page page 当前页码
|
||||
* @return List<Post>集合</>
|
||||
* @return List
|
||||
*/
|
||||
@GetMapping(value = "next")
|
||||
@ResponseBody
|
||||
|
|
|
@ -47,7 +47,7 @@ public class FrontTagController extends BaseController {
|
|||
*
|
||||
* @param tagUrl 标签路径
|
||||
* @param model model
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = "{tagUrl}")
|
||||
public String tags(Model model,
|
||||
|
@ -61,7 +61,7 @@ public class FrontTagController extends BaseController {
|
|||
* @param model model
|
||||
* @param tagUrl 标签路径
|
||||
* @param page 页码
|
||||
* @return string
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping(value = "{tagUrl}/page/{page}")
|
||||
public String tags(Model model,
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
scrollbar: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function openAttachCopy() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
|
@ -281,7 +281,8 @@
|
|||
});
|
||||
}
|
||||
$('#btn_input_postUrl').click(function () {
|
||||
$('#postUrl').html("<input type='text' id='newPostUrl' onblur='urlOnBlurAuto()' value=''>");
|
||||
var postUrl = $("#postUrl").html();
|
||||
$('#postUrl').html("<input type='text' id='newPostUrl' onblur='urlOnBlurAuto()' value='"+postUrl+"'>");
|
||||
$(this).hide();
|
||||
$('#btn_change_postUrl').show();
|
||||
});
|
||||
|
@ -403,4 +404,4 @@
|
|||
</div>
|
||||
<#include "module/_footer.ftl">
|
||||
</div>
|
||||
<@footer></@footer>
|
||||
<@footer></@footer>
|
||||
|
|
Loading…
Reference in New Issue