fix:地区修改后不生效,需要清空缓存才能得到最新的数据问题处理

This commit is contained in:
Chopper711 2023-08-03 12:57:01 +08:00
parent 9f17dcafbb
commit 9dd6bc2d6f
2 changed files with 17 additions and 0 deletions

View File

@ -19,6 +19,15 @@ import java.util.Map;
@CacheConfig(cacheNames = "{regions}")
public interface RegionService extends IService<Region> {
/**
* 更新地区
*
* @param region 地区
* @return
*/
@CacheEvict(allEntries = true)
boolean updateById(Region region);
/**
* 同步行政数据
*

View File

@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@ -36,6 +37,13 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
@Autowired
private Cache cache;
@Override
@Transactional
public boolean updateById(Region region) {
return super.updateById(region);
}
@Override
public void synchronizationData(String url) {
try {