mirror of https://github.com/halo-dev/halo
Replace JPARepository with BaseRepository
parent
c215e40a91
commit
90aa7c1077
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Attachment;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,5 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/1/10
|
||||
*/
|
||||
public interface AttachmentRepository extends JpaRepository<Attachment, Long> {
|
||||
public interface AttachmentRepository extends BaseRepository<Attachment, Long> {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Category;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +12,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2017/11/30
|
||||
*/
|
||||
public interface CategoryRepository extends JpaRepository<Category, Long> {
|
||||
public interface CategoryRepository extends BaseRepository<Category, Long> {
|
||||
|
||||
/**
|
||||
* 根据分类目录路径查询,用于验证是否已经存在该路径
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.ryanc.halo.repository;
|
|||
|
||||
import cc.ryanc.halo.model.domain.Comment;
|
||||
import cc.ryanc.halo.model.domain.Post;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
@ -18,7 +19,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/1/22
|
||||
*/
|
||||
public interface CommentRepository extends JpaRepository<Comment, Long> {
|
||||
public interface CommentRepository extends BaseRepository<Comment, Long> {
|
||||
|
||||
/**
|
||||
* 根据评论状态查询所有评论 分页
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Gallery;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,5 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/2/26
|
||||
*/
|
||||
public interface GalleryRepository extends JpaRepository<Gallery, Long> {
|
||||
public interface GalleryRepository extends BaseRepository<Gallery, Long> {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Link;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,5 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2017/11/14
|
||||
*/
|
||||
public interface LinkRepository extends JpaRepository<Link, Long> {
|
||||
public interface LinkRepository extends BaseRepository<Link, Long> {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Logs;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
|
@ -14,7 +15,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/1/19
|
||||
*/
|
||||
public interface LogsRepository extends JpaRepository<Logs, Long> {
|
||||
public interface LogsRepository extends BaseRepository<Logs, Long> {
|
||||
|
||||
/**
|
||||
* 查询最新的五条数据
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Menu;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,5 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/1/24
|
||||
*/
|
||||
public interface MenuRepository extends JpaRepository<Menu, Long> {
|
||||
public interface MenuRepository extends BaseRepository<Menu, Long> {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Options;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +12,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2017/11/14
|
||||
*/
|
||||
public interface OptionsRepository extends JpaRepository<Options, Long> {
|
||||
public interface OptionsRepository extends BaseRepository<Options, Long> {
|
||||
|
||||
/**
|
||||
* 根据key查询单个option
|
||||
|
|
|
@ -3,6 +3,7 @@ package cc.ryanc.halo.repository;
|
|||
import cc.ryanc.halo.model.domain.Category;
|
||||
import cc.ryanc.halo.model.domain.Post;
|
||||
import cc.ryanc.halo.model.domain.Tag;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
@ -21,7 +22,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2017/11/14
|
||||
*/
|
||||
public interface PostRepository extends JpaRepository<Post, Long>, JpaSpecificationExecutor<Post> {
|
||||
public interface PostRepository extends BaseRepository<Post, Long>, JpaSpecificationExecutor<Post> {
|
||||
|
||||
/**
|
||||
* 查询前五条文章
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Tag;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +12,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/1/12
|
||||
*/
|
||||
public interface TagRepository extends JpaRepository<Tag, Long> {
|
||||
public interface TagRepository extends BaseRepository<Tag, Long> {
|
||||
|
||||
/**
|
||||
* 根据标签路径查询,用于验证是否已经存在该路径
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.repository;
|
||||
|
||||
import cc.ryanc.halo.model.domain.User;
|
||||
import cc.ryanc.halo.repository.base.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +12,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2017/11/14
|
||||
*/
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
public interface UserRepository extends BaseRepository<User, Long> {
|
||||
|
||||
/**
|
||||
* 根据用户名和密码查询
|
||||
|
|
|
@ -3,9 +3,9 @@ package cc.ryanc.halo.service.base;
|
|||
/**
|
||||
* Abstract service implementation.
|
||||
*
|
||||
* @param <ID> id type
|
||||
* @param <DOMAIN> domain type
|
||||
* @param <ID> id type
|
||||
*/
|
||||
public abstract class AbstractService<ID, DOMAIN> implements CrudService<ID, DOMAIN> {
|
||||
public abstract class AbstractCrudService<DOMAIN, ID> implements CrudService<DOMAIN, ID> {
|
||||
|
||||
}
|
|
@ -9,13 +9,13 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* CrudService interface contained public methods.
|
||||
* CrudService interface contains some common methods.
|
||||
*
|
||||
* @param <ID> id type
|
||||
* @param <DOMAIN> domain type
|
||||
* @param <ID> id type
|
||||
* @author johnniang
|
||||
*/
|
||||
public interface CrudService<ID, DOMAIN> {
|
||||
public interface CrudService<DOMAIN, ID> {
|
||||
|
||||
// **************** Select
|
||||
|
||||
|
|
Loading…
Reference in New Issue