123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- package com.hssx.bms.controller;
- import com.hssx.bms.entity.Book;
- import com.hssx.bms.entity.BookCategory;
- import com.hssx.bms.entity.BookPage;
- import com.hssx.bms.service.BookCategoryService;
- import com.hssx.bms.service.BookPageService;
- import com.hssx.bms.service.BookService;
- import com.hssx.bms.until.HttpRespMsg;
- import com.hssx.bms.until.PageUtil;
- import io.swagger.annotations.ApiOperation;
- 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.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.multipart.MultipartFile;
- import java.util.List;
- /**
- * @author 吴涛涛
- * @since 2019-10-16
- */
- @Controller
- @RequestMapping("/book")
- public class BookController {
- @Autowired
- private BookService bookService;
- @Autowired
- private BookPageService bookPageService;
- @Autowired
- private BookCategoryService bookCategoryService;
- /**
- * 图书信息的录入
- * 参数:name 名称,author 作者,descrip 描述
- * file 封面文件(可不传)
- * 修改时需要:id 图书id
- * @return
- */
- @ApiOperation(value = "图书信息的录入", notes = "图书信息的录入")
- @RequestMapping("/addOrUpdateBook")
- @ResponseBody
- public HttpRespMsg addOrUpdateBook(Book book, @RequestParam(required = false) MultipartFile file){
- HttpRespMsg msg = bookService.addOrUpdateBook(book,file);
- return msg;
- }
- /**
- * 图书信息的列表
- * 参数:
- * @return
- */
- @ApiOperation(value = "图书信息的列表", notes = "图书信息的列表方法")
- @RequestMapping("/list")
- @ResponseBody
- public HttpRespMsg list(PageUtil page){
- HttpRespMsg msg = bookService.getList(page);
- return msg;
- }
- /**
- * 图书信息的录入
- * 参数:bookId 图书对应的id
- * file 上传的图书图片文件zip(内部文件命名按照对应页码命名如1.jpg:第一页)
- * @return
- */
- @ApiOperation(value = "图书图片的上传", notes = "图书图片的上传方法")
- @RequestMapping("/addBookPage")
- @ResponseBody
- public HttpRespMsg addBookPage(BookPage bookPage, @RequestParam(required = false) MultipartFile zipFile){
- HttpRespMsg msg = bookPageService.addBookPage(bookPage,zipFile);
- return msg;
- }
- /**
- * 图书图片删除
- * 参数:id 图书图片对应的id
- * @return
- */
- @ApiOperation(value = "图书图片删除", notes = "图书图片删除方法")
- @RequestMapping("/deleteBookPage")
- @ResponseBody
- public HttpRespMsg deleteBookPage(BookPage bookPage){
- HttpRespMsg msg = new HttpRespMsg();
- msg.data = bookPageService.removeById(bookPage.getId());
- return msg;
- }
- /**
- * 单个图书图片列表(图片总张数)
- * 参数:bookId 图书的id
- * @return
- */
- @ApiOperation(value = "单个图书图片列表(图片总张数)", notes = "单个图书图片列表(图片总张数)方法")
- @RequestMapping("/bookPageList")
- @ResponseBody
- public HttpRespMsg bookPageList(BookPage bookPage){
- HttpRespMsg msg = bookPageService.getBookPageList(bookPage);
- return msg;
- }
- /**
- * 图书目录的录入/修改
- * 参数:bookId 图书id rank 章节(对应数字0-序 1-第一章 2-第二章...)
- * name 目录名称 pageNum 起始页码
- * 修改时:需要传 id 目录的id
- * @return
- */
- @ApiOperation(value = "图书目录的录入和修改", notes = "图书目录的录入和修改方法")
- @RequestMapping("/addOrUpdateRank")
- @ResponseBody
- public HttpRespMsg addOrUpdateRank(BookCategory BookCategory){
- HttpRespMsg msg = bookCategoryService.addOrUpdateRank(BookCategory);
- return msg;
- }
- /**
- * 图书目录的删除
- * 修改时:需要传 id 目录的id
- * @return
- */
- @ApiOperation(value = "图书目录的删除", notes = "图书目录的删除方法")
- @RequestMapping("/delRank")
- @ResponseBody
- public HttpRespMsg delRank(BookCategory BookCategory){
- HttpRespMsg msg = new HttpRespMsg();
- bookCategoryService.removeById(BookCategory.getId());
- return msg;
- }
- /**
- * 图书详情
- * 参数 id 图书id
- * @param book
- * @return
- */
- @ApiOperation(value = "图书详情", notes = "图书详情")
- @RequestMapping("/detail")
- @ResponseBody
- public HttpRespMsg detail(Book book){
- HttpRespMsg msg = new HttpRespMsg();
- msg = bookService.getBookDetailById(book.getId());
- return msg;
- }
- /**
- * 图书的删除
- * 参数 id 图书id
- * @param book
- * @return
- */
- @ApiOperation(value = "图书的删除 ", notes = "图书删除方法")
- @RequestMapping("/del")
- @ResponseBody
- public HttpRespMsg del(Book book){
- HttpRespMsg msg = new HttpRespMsg();
- msg = bookService.del(book.getId());
- return msg;
- }
- }
|