BasicDao 的抽取
Dao 全称为(Data Access Object)数据访问接口,数据访问:顾名思义就是与数据库打交道。又称JavaBean 又称为domain 话不多说,直接上图
在写JavaBean的时候总是会遇到有相同的操作的地方,因此提出Basic
根据上图写出项目结构
给出两个表
根据上图首先对actor表和goods表进行映射
package com.cclStu.domain;
import java.util.Date;
/**
* @author: 13749
* @date: 2021/9/23 17:18
* @description:
*/
public class Actor {
private Integer id ;
private String name;
private String sex;
private Date borndate;
private String phone;
public Actor() {
//底层可能用到反射,反射需要无参构造器
}
public Actor(Integer id, String name, String sex, Date borndate, String phone) {
this.id = id;
this.name = name;
this.sex = sex;
this.borndate = borndate;
this.phone = phone;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Date getBorndate() {
return borndate;
}
public void setBorndate(Date borndate) {
this.borndate = borndate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return "Actor{" +
"id=" + id +
", name='" + name + '\'' +
", sex='" + sex + '\'' +
", borndate=" + borndate +
", phone='" + phone + '\'' +
'}';
}
}
package com.cclStu.domain;
/**
* @author: 13749
* @date: 2021/9/27 18:58
* @description:
*/
public class Goods {
private Integer id;
private String goods_name;
private String price;
//反射可能会用到
public Goods() {
}
public Goods(Integer id, String goods_name, String price) {
this.id = id;
this.goods_name