2013/12/25

package com.yys.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.yys.dao.BaseDao;
import com.yys.service.BaseService;
/**
 * 抽象的service实现,专门用于继承
 */
public abstract class BaseServiceImpl<T> implements BaseService<T> {
    private BaseDao<T> baseDao;
    //注入baseDao
    @Resource
 public void setBaseDao(BaseDao<T> baseDao) {
  this.baseDao = baseDao;
 }

 @Override
 public void saveEntity(T t) throws Exception {
  this.baseDao.saveEntity(t);
 }

 @Override
 public void deleteEntity(T t) throws Exception {
  this.baseDao.deleteEntity(t);
  
 }

 @Override
 public void updateEntity(T t) throws Exception {
  this.baseDao.updateEntity(t);
  
 }

 @Override
 public void saveOrUpdate(T t) throws Exception {
  this.baseDao.saveOrUpdate(t);
  
 }

 @Override
 public void batchEntityByHql(String Hql, Object... objects)
   throws Exception {
  this.baseDao.batchEntityByHql(Hql, objects);
  
 }

 @Override
 public T getEntity(Integer id) {
  return this.baseDao.getEntity(id);
 }

 @Override
 public T loadEntity(Integer id) {
  return this.baseDao.loadEntity(id);
 }

 @Override
 public List<T> findEntityByHQL(String Hql, Object... objects) {
  return this.baseDao.findEntityByHQL(Hql, objects);
 }

}

你可能感兴趣的:(2013/12/25)