缓存管理器
This commit is contained in:
@@ -7,6 +7,9 @@ import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -16,6 +19,7 @@ import java.util.Date;
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
@CacheConfig(cacheNames = "common")
|
||||
@Service
|
||||
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
|
||||
|
||||
@@ -43,19 +47,20 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@CachePut(key = "#type")
|
||||
@Override
|
||||
public CommonInfo findOne(int type) {
|
||||
return commonInfoDao.findOne(type);
|
||||
}
|
||||
|
||||
@CacheEvict
|
||||
@Override
|
||||
public Result delete(long id) {
|
||||
commonInfoDao.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@CacheEvict
|
||||
@Override
|
||||
public Result updateBody(CommonInfo commonInfo) {
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
|
||||
Reference in New Issue
Block a user