//数据库操作基本父类
public class DaoImplimplement Dao{
private Connection conn;
private prepareStatement pstm;
private String sql;
//反射
Classtype;
public DaoImpl(){
Class clazz=this.getClass();
ParemeterizedType paremeterizedType=( paremeterizedType) clazz
Type[]type=(class)types[0];
}
}
public int delete(T t){
try{
//表名;插入字段
String sq1=“delete from”+tableName+“where id=?”;
Field field[]=type.getDeclaredFields();
//1.获取连接
conn=DBUtils.getConn();
//2.执行命令
pstm=conn。prepareStatement(aql);
//3.填充占位符 调用对象得get方法
Sqlutil.initPstm();
//4.执行命令
pstm.executeUpdate();
//4.关闭连接
DBUtils.close(conn,pstm,null);
}
catch(Exception e){
e.printstackTrace();
}
return false;
}
//数据库操作基本规范
public interface Dao{
//增删改查
public boolean add(T t);
public int delete(T t);
public int update(T t);
public int find();
public int query();
}