新增:
public int AddAll(Object object) {
int count=0;
Class class1 = object.getClass();
Field[] fields = class1.getDeclaredFields();
Field.setAccessible(fields, true);
Connection con = BaseDao.getConn();
StringBuffer sql=new StringBuffer("insert into "+class1.getSimpleName()+" (");
for (int i = 1; i < fields.length; i++) {
sql.append(fields[i].getName());
if(i<fields.length-1) {
sql.append(",");
}
}
sql.append(") values (");
for (int i = 1; i < fields.length; i++) {
sql.append("?");
if(i<fields.length-1) {
sql.append(",");
}
}
sql.append(")");
PreparedStatement stm=null;
try {
stm = con.prepareStatement(sql.toString());
//给值
for (int i = 1; i < fields.length; i++) {
stm.setObject(i, fiel