You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookStore/src/com/yj/dao/BookDao.java

115 lines
3.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.yj.dao;
import com.yj.bean.Book;
import java.math.BigDecimal;
import java.util.List;
/**
* @author yj
* @create 2020-08-23 21:08
*
* BookDao接口定义了对书籍数据的操作方法包括增删改查、分页查询、按价格范围查询、按名称或作者查询等功能。
*/
public interface BookDao {
/**
* 添加一本书籍到数据库
* @param book 要添加的书籍对象
* @return 受影响的行数成功返回1失败返回0
*/
public int addBook(Book book);
/**
* 根据书籍ID删除书籍
* @param id 要删除的书籍ID
* @return 受影响的行数成功返回1失败返回0
*/
public int deleteBookById(Integer id);
/**
* 更新书籍信息
* @param book 包含更新信息的书籍对象
* @return 受影响的行数成功返回1失败返回0
*/
public int updateBook(Book book);
/**
* 根据书籍ID查询书籍信息
* @param id 要查询的书籍ID
* @return 查询到的书籍对象如果未找到返回null
*/
public Book queryBookById(Integer id);
/**
* 查询所有书籍信息
* @return 包含所有书籍的列表
*/
public List<Book> queryBooks();
/**
* 查询所有书籍的总记录数
* @return 所有书籍的总记录数
*/
Integer queryForPageTotalCount();
/**
* 分页查询书籍信息
* @param begin 分页的起始索引
* @param pageSize 每页显示的记录数
* @return 当前页的书籍列表
*/
List<Book> queryForPageItems(int begin, int pageSize);
/**
* 根据价格范围查询书籍的总记录数
* @param min 价格范围的最小值
* @param max 价格范围的最大值
* @return 符合价格范围的书籍总记录数
*/
Integer queryForPageTotalCountByPrice(int min, int max);
/**
* 根据价格范围分页查询书籍信息
* @param begin 分页的起始索引
* @param pageSize 每页显示的记录数
* @param min 价格范围的最小值
* @param max 价格范围的最大值
* @return 当前页的书籍列表
*/
List<Book> queryForPageItemsByPrice(int begin, int pageSize, int min, int max);
/**
* 根据书籍名称或作者查询书籍的总记录数
* @param nameorauthor 书籍名称或作者的关键字
* @return 符合条件的书籍总记录数
*/
Integer queryForPageTotalCountByNameOrAuthor(String nameorauthor);
/**
* 根据书籍名称或作者分页查询书籍信息
* @param begin 分页的起始索引
* @param pageSize 每页显示的记录数
* @param nameorauthor 书籍名称或作者的关键字
* @return 当前页的书籍列表
*/
List<Book> queryForPageItemsByNameOrAuthor(int begin, int pageSize, String nameorauthor);
/**
* 查询所有书籍并按某种顺序排序(如销量、价格等)
* @return 按顺序排序的书籍列表
*/
List<Book> queryForPageItemsOrder();
/**
* 查询所有书籍的总金额(价格总和)
* @return 所有书籍的总金额
*/
BigDecimal queryTotalMoney();
/**
* 查询书籍的总数量
* @return 书籍的总数量
*/
public Integer queryBooknums();
}