仿极简图床

一、使用技术
后端:Spring Boot+Spring Data JPA+RESTful API+swagger
前端:VUE.js+VUE cli+bootstrap+jQuery+axios
二、效果图


极简主页.png
某个相册.png

三、源码
后端代码


项目目录.png

相册类
@Entity
@Data
public class Album {
@Id
@GeneratedValue
private Integer id;

private String albumCover;

private String albumTitle;

private String albumDescription;

private Integer likes;

}
某个相册内容类
@Entity
@Data
public class AlbumCatena {
@Id
@GeneratedValue
private Integer id;
private String picture;
private String title;
private Integer album_id;

}
相册接口
public interface AlbumRepository extends JpaRepository{
@Query("select u from Album u order by u.likes desc")
ListfindHot();

ListfindAll();

}
某个相册内容接口

public interface AlbumCatenaRepository extends JpaRepository {
AlbumCatena findAlbumCatenaById(Integer id);

@Query("select u from AlbumCatena u where u.album_id=?1")
ListfindAlbumCatenas(Integer id);

}
相册service
public interface AlbumService {
List getall();
}
某个相册内容service
public interface AlbumCatenaService {
ListfindAlbumCatenas(Integer id);
}
相册service实现类
@Service
public class AlbumImpl implements AlbumService {
@Resource
private AlbumRepository albumRepository;

@Override
public List getall() {
    return albumRepository.findAll();
}

}
某个相册内容service实现类
@Service
public class AlbumCatenaImpl implements AlbumCatenaService {
@Resource
private AlbumCatenaRepository albumCatenaRepository;
@Override
public List findAlbumCatenas(Integer id) {
return albumCatenaRepository.findAlbumCatenas(id);
}
}
给前端提供接口
@RestController
@CrossOrigin
@RequestMapping(value = "/books")
public class BoController {
@Resource
private AlbumService albumService;
@Resource
private AlbumCatenaService albumCatenaService;

@GetMapping("/album")
public Listgetallalbum(){
    return albumService.getall();
}

@GetMapping("/{id}")
public Listgetcatenas(@PathVariable Integer id){
    System.out.println(albumCatenaService.findAlbumCatenas(id));
    return albumCatenaService.findAlbumCatenas(id);
}

}
前端代码
相册页面


某个相册内容页面

你可能感兴趣的:(仿极简图床)