1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-17 23:46:12 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

删除书籍功能实现

This commit is contained in:
2022-04-06 23:15:37 +08:00
parent 3d2e9b6dfa
commit 61ecc5600a
5 changed files with 91 additions and 2 deletions

View File

@@ -35,6 +35,11 @@ public class BookServiceImpl implements BookService {
@Autowired
ValidatorImpl validator;
/**
* 通过 书籍id 查找图书
* @param id
* @return
*/
@Override
@Transactional
public BookModel getBookById(Integer id) {
@@ -44,6 +49,12 @@ public class BookServiceImpl implements BookService {
return bookModel;
}
/**
* 查找图书
* @param bookModel
* @return
* @throws BusinessException
*/
@Override
public List<BookModel> searchBooks(BookModel bookModel) throws BusinessException {
@@ -72,6 +83,12 @@ public class BookServiceImpl implements BookService {
return convertFromDataObjecctList(bookDOs);
}
/**
* 添加图书
* @param bookModel
* @return
* @throws BusinessException
*/
@Override
public Integer addBook(BookModel bookModel) throws BusinessException {
// 校验入参
@@ -84,6 +101,12 @@ public class BookServiceImpl implements BookService {
return bookDOMapper.insertSelective(bookDO);
}
/**
* 修改图书信息
* @param bookModel
* @return
* @throws BusinessException
*/
@Override
public Integer modifyBook(BookModel bookModel) throws BusinessException {
// 校验入参
@@ -96,6 +119,20 @@ public class BookServiceImpl implements BookService {
return bookDOMapper.updateByPrimaryKeySelective(bookDO);
}
/**
* 通过 id 删除图书
* @param bookId
* @return
* @throws BusinessException
*/
@Override
public Integer deleteBook(Integer bookId) throws BusinessException {
if(bookId == null || bookId == 0) {
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "书籍id不能为空");
}
return bookDOMapper.deleteByPrimaryKey(bookId);
}
/**
* 用户收藏书籍
*