📄 commandadpater.java
字号:
package com.xfaccp.adapter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.xfaccp.base.BaseForm;
import com.xfaccp.interf.ICommand;
import com.xfaccp.interf.IDAO;
public abstract class CommandAdpater implements ICommand
{
/*
* 依敕注入若干个DAO
* 以便该处理事务的适配器可以
* 同时关联操作到多个对象
*/
protected IDAO dao;
protected IDAO daoTwo;
//加载spring配置文件时set方法用于依敕注入若干DAO对象
public void setDao(IDAO dao)
{
this.dao = dao;
}
public void setDaoTwo(IDAO dao)
{
this.daoTwo = dao;
}
/*
* (non-Javadoc)
* @实现ICommand接口中的方法的适配器类
* 可以部分实现或是全部实现
* 这样该适配器类就可以
* 根据实际情况相应适配
*/
public Map create(BaseForm form) throws Exception
{
this.dao.create(form);
return null;
}
public Map create(List list) throws Exception
{
if(list != null && list.size() > 0)
{
for(int k = 0; k< list.size(); k ++)
{
dao.create((BaseForm)list.get(k));
}
}
return null;
}
public Map create(Map map) throws Exception
{
return null;
}
public Map delete(BaseForm form) throws Exception
{
this.dao.delete(form);
return null;
}
public List findAllList() throws Exception
{
List list=this.dao.findAllList();
return list;
}
public List findByExample(BaseForm form) throws Exception
{
List list=dao.findByExample(form);
return list;
}
public List findById(Integer id) throws Exception
{
return null;
}
public Map load(BaseForm form) throws Exception
{
this.dao.load(form);
return null;
}
public Map update(BaseForm form) throws Exception
{
this.dao.update(form);
return null;
}
public Map update(List list) throws Exception
{
if(list != null && list.size() > 0)
{
for(int k = 0; k < list.size(); k ++)
{
dao.update((BaseForm)list.get(k));
}
}
return null;
}
public Map update(Map map) throws Exception
{
// TODO Auto-generated method stub
return null;
}
public List checkLogin(String useName, String password) throws Exception {
List list=new ArrayList();
list=dao.checkLogin(useName, password);
return list;
}
public List findBySql()throws Exception
{
return null;
}
public List findBySqlto(String hsql,Object [] obj)throws Exception
{
List list=dao.findBySqlto(hsql,obj);
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -