微信登录

JDBC - interface接口 - XxxDAO.java

接口

只有方法
然后去实现

  1. package com.atguigu3.dao;
  2. import java.sql.Connection;
  3. import java.sql.Date;
  4. import java.util.List;
  5. import com.atguigu2.bean.Customer;
  6. /*
  7. * 此接口用于规范针对于customers表的常用操作
  8. */
  9. public interface CustomerDAO {
  10. /**
  11. *
  12. * @Description 将cust对象添加到数据库中
  13. * @author shkstart
  14. * @date 上午11:00:27
  15. * @param conn
  16. * @param cust
  17. */
  18. void insert(Connection conn,Customer cust);
  19. /**
  20. *
  21. * @Description 针对指定的id,删除表中的一条记录
  22. * @author shkstart
  23. * @date 上午11:01:07
  24. * @param conn
  25. * @param id
  26. */
  27. void deleteById(Connection conn,int id);
  28. /**
  29. *
  30. * @Description 针对内存中的cust对象,去修改数据表中指定的记录
  31. * @author shkstart
  32. * @date 上午11:02:14
  33. * @param conn
  34. * @param cust
  35. */
  36. void update(Connection conn,Customer cust);
  37. /**
  38. *
  39. * @Description 针对指定的id查询得到对应的Customer对象
  40. * @author shkstart
  41. * @date 上午11:02:59
  42. * @param conn
  43. * @param id
  44. */
  45. Customer getCustomerById(Connection conn,int id);
  46. /**
  47. *
  48. * @Description 查询表中的所有记录构成的集合
  49. * @author shkstart
  50. * @date 上午11:03:50
  51. * @param conn
  52. * @return
  53. */
  54. List<Customer> getAll(Connection conn);
  55. /**
  56. *
  57. * @Description 返回数据表中的数据的条目数
  58. * @author shkstart
  59. * @date 上午11:04:44
  60. * @param conn
  61. * @return
  62. */
  63. Long getCount(Connection conn);
  64. /**
  65. *
  66. * @Description 返回数据表中最大的生日
  67. * @author shkstart
  68. * @date 上午11:05:33
  69. * @param conn
  70. * @return
  71. */
  72. Date getMaxBirth(Connection conn);
  73. }
JDBC - interface接口 - XxxDAO.java