1.BlogDao.java
package com.zr.dao;
import com.zr.po.Blog;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BlogDao extends JpaRepository<Blog,Long> {
}
2.BlogDao.java
package com.zr.dao;
import com.zr.po.Tag;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TagDao extends JpaRepository<Tag,Long> {
}
3.BlogServiceImpl.java
package com.zr.service.impl;
import com.zr.dao.BlogDao;
import com.zr.po.Blog;
import com.zr.service.IBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@Service
public class BlogServiceImpl implements IBlogService {
@Autowired
private BlogDao blogDao;
@Override
public Page<Blog> listBlog(Pageable pageable) {
return blogDao.findAll(pageable);
}
@Override
public void deleteBlogById(Long id) {
blogDao.deleteById(id);
}
}
4.TagServiceImpl.java
package com.zr.service.impl;
import com.zr.dao.TagDao;
import com.zr.po.Tag;
import com.zr.po.Type;
import com.zr.s