public abstract class BaseServiceImpl<T> implements IBaseService<T> {
public abstract IBaseDao<T> getBaseDao();//注入的实体类
public int add(T t) {
return getBaseDao().add(t);
}
public int update(T t) {
return getBaseDao().update(t);
}
public T getById(Integer id) {
return getBaseDao().getById(id);
}
public int delete(Integer id) {
return getBaseDao().delete(id);
}
public void getPage(Page page) {
Integer currentPage = page.getCurrentPage();
Integer pageSize = page.getPageSize();
page.setList(getBaseDao().getList((currentPage-1)*pageSize,pageSize));
page.setTotalCount(getBaseDao().getCount());
}
}