Class SalesDAO
java.lang.Object
br.com.pethub.dao.SalesDAO
This class is responsible for managing the data access for the Sales in the application.
It provides methods to add sales, return the last sale, list sales by date range, return total sales for a day, delete sales by customer id, and generate a last sale report.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is used to add a sale to the database.void
deleteSalesByCustomerId
(int customerId) This method is used to delete sales by customer id.void
This method is used to generate a last sale report.This method is used to retrieve a list of all sales within a date range from the database.int
This method is used to return the last sale from the database.double
returnTotalSalesDay
(LocalDate sale_date) This method is used to return the total sales for a day.
-
Constructor Details
-
SalesDAO
public SalesDAO()The constructor method of the SalesDAO class.
-
-
Method Details
-
addSales
This method is used to add a sale to the database.- Parameters:
obj
- The sale to be added.
-
returnLastSale
public int returnLastSale()This method is used to return the last sale from the database.- Returns:
- The id of the last sale.
-
listSales
This method is used to retrieve a list of all sales within a date range from the database.- Parameters:
date_start
- The start date of the range.date_end
- The end date of the range.- Returns:
- A list of all sales within the date range.
-
returnTotalSalesDay
This method is used to return the total sales for a day.- Parameters:
sale_date
- The date to return total sales for.- Returns:
- The total sales for the day.
-
deleteSalesByCustomerId
public void deleteSalesByCustomerId(int customerId) This method is used to delete sales by customer id.- Parameters:
customerId
- The id of the customer to delete sales for.
-
lastSaleReport
public void lastSaleReport()This method is used to generate a last sale report.
-