package cn.com.craw.contant.dao;
import java.util.List;
import cn.com.craw.command.support.JDBCSupport;
import cn.com.craw.command.util.SqlUtils;
public class BaseDao<T> extends JDBCSupport {
private String mark;
public BaseDao(String mark){
this.mark = mark;
}
public boolean insert(T t){
String sql;
try {
sql = SqlUtils.getInsertSql_2(t);
return this.getTemplate().executeUpdte(SqlUtils.params.toArray(), sql, mark) > 0 ? true : false;
}catch (Exception e) {
e.printStackTrace();
}
return false;
}
public boolean update(T t, T whereEntity){
try {
String sql = SqlUtils.getUpdateSql(t, whereEntity);
return this.getTemplate().executeUpdte(SqlUtils.params.toArray(), sql, mark) > 0 ? true : false;
} catch (Exception e) {
import java.util.List;
import cn.com.craw.command.support.JDBCSupport;
import cn.com.craw.command.util.SqlUtils;
public class BaseDao<T> extends JDBCSupport {
private String mark;
public BaseDao(String mark){
this.mark = mark;
}
public boolean insert(T t){
String sql;
try {
sql = SqlUtils.getInsertSql_2(t);
return this.getTemplate().executeUpdte(SqlUtils.params.toArray(), sql, mark) > 0 ? true : false;
}catch (Exception e) {
e.printStackTrace();
}
return false;
}
public boolean update(T t, T whereEntity){
try {
String sql = SqlUtils.getUpdateSql(t, whereEntity);
return this.getTemplate().executeUpdte(SqlUtils.params.toArray(), sql, mark) > 0 ? true : false;
} catch (Exception e) {