完整代码下载链接:https://download.csdn.net/download/d_c_hao/10987189
接口类:
public interface IMyDB {
/**
* 根据表名与某一字段条件返回list
*/
public List
}
--------------------
接口实现类:
public class MyDBImpl implements IMyDB {
private IUAPQueryBS query;
private IVOPersistence ivo;
private BaseDAO baseDAO;
/**
* 获取baseDAO
* @return
*/
public BaseDAO getBaseDAO() {
if(baseDAO == null){
baseDAO = new BaseDAO();
}
return baseDAO;
}
public void setBaseDAO(BaseDAO baseDAO) {
this.baseDAO = baseDAO;
}
@Override
/**
* 根据表名与某一字段条件返回list
*/
public List
@Override
public int doDeleteSql(String table, String whereCon) {
// TODO 自动生成的方法存根
int row= 0;
String sql= "delete from " +table+ " where " +whereCon;
try {
row= getBaseDAO().executeUpdate(sql);
} catch (DAOException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
return row;
}
// 获取IUAPQueryBS
public IUAPQueryBS getQuery() {
if (query == null) {
query = (IUAPQueryBS) NCLocator.getInstance().lookup(
IUAPQueryBS.class.getName());
}
return query;
}
public void setQuery(IUAPQueryBS query) {
this.query = query;
}
// 获取IVOPersistence
public IVOPersistence getIvo() {
if (ivo == null) {
ivo = (IVOPersistence) NCLocator.getInstance().lookup(
IVOPersistence.class.getName());
}
return ivo;
}
public void setIvo(IVOPersistence ivo) {
this.ivo = ivo;
}
}