mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-22 01:30:40 +08:00
删除独立的作者、出版社、缩略图表;修正部分字段;实现部分Service以及Controller;项目框架基本建立
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package plus.bookshelf.Controller.Controller;
|
||||
|
||||
public class BaseController {
|
||||
public static final String CONTENT_TYPE_FORMED = "application/x-www-form-urlencoded";
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package plus.bookshelf.Controller.Controller;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import plus.bookshelf.Controller.VO.BookVO;
|
||||
import plus.bookshelf.Service.Model.BookModel;
|
||||
import plus.bookshelf.Service.Service.BookService;
|
||||
|
||||
@Controller("book")
|
||||
@RequestMapping("/apiv1/book")
|
||||
public class BookController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
BookService bookService;
|
||||
|
||||
@RequestMapping(value = "get", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public BookVO get(@RequestParam(value = "id") Integer id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BookModel bookModel = bookService.getBookById(id);
|
||||
BookVO bookVO = convertFromModel(bookModel);
|
||||
return bookVO;
|
||||
}
|
||||
|
||||
private BookVO convertFromModel(BookModel bookModel) {
|
||||
BookVO bookVO = new BookVO();
|
||||
BeanUtils.copyProperties(bookModel, bookVO);
|
||||
return bookVO;
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package plus.bookshelf.Controller.VO;
|
||||
|
||||
import lombok.Data;
|
||||
import plus.bookshelf.Common.Enum.Language;
|
||||
import plus.bookshelf.Service.Model.CategoryModel;
|
||||
|
||||
@Data
|
||||
public class BookVO {
|
||||
|
||||
// 书籍id
|
||||
Integer id;
|
||||
|
||||
// 书名
|
||||
String bookName;
|
||||
|
||||
// 书籍简介
|
||||
String description;
|
||||
|
||||
// 作者姓名
|
||||
String author;
|
||||
|
||||
//书籍所属分类
|
||||
CategoryModel category;
|
||||
|
||||
// 出版社
|
||||
String publishingHouse;
|
||||
|
||||
// 语言
|
||||
Language language;
|
||||
|
||||
// 来源(版权)信息
|
||||
String copyright;
|
||||
|
||||
// 缩略图
|
||||
String thumbnail;
|
||||
}
|
Reference in New Issue
Block a user