1.CustomerService
//顾客表操作
package Service; import java.util.List; import DAO.CustomerDAO; import Factory.DAOFactory; import StoreManager.Customer; public class CustomerService { CustomerDAO cusDao = DAOFactory.getCustomerDAO(); public int insert(Customer cus) throws Exception { return cusDao.insert(cus); } public void delete(String cusid) throws Exception{ cusDao.delete(cusid); } public String[][] queryById(String cusid) throws Exception{ return cusDao.queryById(cusid); } public List<String> queryAll() throws Exception{ return cusDao.queryAll(); } public void update(Customer cus) throws Exception{ cusDao.update(cus); } public int update1(Customer cus) throws Exception{ return cusDao.update1(cus); } public int shopping(double balance,String id) throws Exception{ return cusDao.shopping(balance, id); } public double getBalance(String id) throws Exception{ return cusDao.getBalance(id); } public void update2(Customer cus) throws Exception{ cusDao.update2(cus); } }
2.FlowerService
//鲜花表操作
package Service; import java.util.List; import DAO.FlowerDAO; import Factory.DAOFactory; import StoreManager.Flower; public class FlowerService { FlowerDAO floDao = DAOFactory.getFlowerDAO(); public void insert(Flower flo) throws Exception{ floDao.insert(flo); } public void delete(int flid) throws Exception{ floDao.delete(flid); } public String[][] queryById(int flid) throws Exception{ return floDao.queryById(flid); } public String[][] queryByName(String flname) throws Exception{ return floDao.queryByName(flname); } public double getPrice(String flname) throws Exception{ return floDao.getPrice(flname); } public List<String> queryAll() throws Exception{ return floDao.queryAll(); } public List<String> queryComBox() throws Exception{ return floDao.queryComBox(); } public void update(Flower flo) throws Exception{ floDao.update(flo); } public int getStore(String name) throws Exception{ return floDao.getStore(name); } public int shopping(int number,String name) throws Exception{ return floDao.shopping(number, name); } }
3.OrdersService
//订单表操作
package Service; import java.util.List; import DAO.OrdersDAO; import Factory.DAOFactory; import StoreManager.Orders; public class OrdersService { OrdersDAO orDao = DAOFactory.getOrdersDAO(); public void insert(String s1,String s2,String s3,double s4) throws Exception{ orDao.insert(s1, s2, s3, s4); } public String[][] queryById(String ordid) throws Exception{ return orDao.queryById(ordid); } public List<String> queryByC_Id(String cusid) throws Exception{ return orDao.queryByC_Id(cusid); } public List<String> queryAll() throws Exception{ return orDao.queryAll(); } public void delete(int ordid) throws Exception{ orDao.delete(ordid); } public void update(Orders ord) throws Exception{ orDao.update(ord); } public void storemessageclear(){ orDao.storemessageclear(); } }
4.UserService
//管理员表操作
package Service; import java.util.List; import DAO.UserDAO; import Factory.DAOFactory; import StoreManager.User; public class UserService { UserDAO userDAO = DAOFactory.getUserDAO(); public void insert(User user) throws Exception{ userDAO.insert(user); } public void delete(String userid) throws Exception{ userDAO.delete(userid); } public String[][] queryById(String userid) throws Exception{ return userDAO.queryById(userid); } public List<String> queryAll() throws Exception{ return userDAO.queryAll(); } public void update(User user) throws Exception{ userDAO.update(user); } public void update1(User user) throws Exception{ userDAO.update1(user); } }