采用jdk8新特效:默认方法

淘汰BaseServiceImpl类
master
星期八 5 years ago
parent 05466b1356
commit a13f590f4b
  1. 36
      src/main/java/com/lq/code/service/BaseService.java
  2. 2
      src/main/java/com/lq/code/service/impl/BaseServiceImpl.java

@ -1,6 +1,7 @@
package com.lq.code.service;
import com.lq.code.dao.BaseDao;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -11,20 +12,39 @@ public interface BaseService<T> {
BaseDao<T> getBaseDao();
T findOne(Long id);
default T findOne(Long id){
return getBaseDao().findOne(id);
}
List<T> findAll();
default List<T> findAll(){
return getBaseDao().findAll();
}
Long save(T entity);
default Long save(T entity){
return getBaseDao().save(entity);
}
void update(T entity);
default void update(T entity){
getBaseDao().update(entity);
}
void delete(Long id);
default void delete(Long id){
getBaseDao().delete(id);
}
void batchSave(List<T> entitylist);
@Transactional
default void batchSave(List<T> entitylist){
getBaseDao().batchSave(entitylist);
}
void batchUpdate(List<T> entitylist);
@Transactional
default void batchUpdate(List<T> entitylist){
getBaseDao().batchSave(entitylist);
}
void batchDelete(List<T> entitylist);
@Transactional
default void batchDelete(List<T> entitylist){
getBaseDao().batchDelete(entitylist);
}
}

@ -8,7 +8,9 @@ import java.util.List;
/**
* Created by qi_liang on 2018/6/21.
*  采用jdk8 默认方法所以该实现类废弃
*/
@Deprecated
public abstract class BaseServiceImpl<T> implements BaseService<T>{
@Override
public abstract BaseDao<T> getBaseDao();

Loading…
Cancel
Save