@IocBean
public class EquipmentDao implements DaoInterceptor{
private static Log log = Logs.get();
@Inject
Dao dao;
@Override
public void filter(DaoInterceptorChain chain) throws DaoException {
DaoStatement st = chain.getDaoStatement();
if (st instanceof NutPojo) {
// 如果是dao.insert(user)之类的操作,会进入这个分支
log.info("aaa.....");
} else if (st instanceof NutSql) {
// 如果是自定义SQL,会进入这个分支
log.info("bbb.....");
}
chain.doChain();//继续下一个拦截器执行
}
/**
* 查询所有设备类型
* @return
*/
public List<DcEquipmentType> queryDcEquipmentTypeList(){
Criteria cnd = Cnd.NEW();
cnd.where().and("del_flag", "=", 0);
return dao.query(DcEquipmentType.class, cnd);
}
}
4 回复
添加回复
请先登陆