|
@@ -3,10 +3,10 @@ package com.citu.module.menduner.system.service.area;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.framework.common.util.object.BeanUtils;
|
|
|
-import com.citu.module.menduner.system.controller.app.area.vo.AppAreaChildrenRespVO;
|
|
|
import com.citu.module.menduner.system.controller.admin.area.vo.AreaListReqVO;
|
|
|
import com.citu.module.menduner.system.controller.admin.area.vo.AreaPageReqVO;
|
|
|
import com.citu.module.menduner.system.controller.admin.area.vo.AreaSaveReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.app.area.vo.AppAreaChildrenRespVO;
|
|
|
import com.citu.module.menduner.system.controller.app.area.vo.AppAreaListReqVO;
|
|
|
import com.citu.module.menduner.system.controller.app.area.vo.AppAreaSimpleRespVO;
|
|
|
import com.citu.module.menduner.system.convert.AreaConvert;
|
|
@@ -38,8 +38,7 @@ public class AreaServiceImpl implements AreaService {
|
|
|
|
|
|
@Resource
|
|
|
private AreaMapper areaMapper;
|
|
|
- @Resource
|
|
|
- private RedisTemplate<String, AppAreaChildrenRespVO> redisTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createArea(AreaSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
@@ -50,7 +49,7 @@ public class AreaServiceImpl implements AreaService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @CacheEvict(cacheNames = RedisKeyConstants.MDE_AREA_CHILDREN_id_LIST,
|
|
|
+ @CacheEvict(cacheNames = {RedisKeyConstants.MDE_AREA_CHILDREN_id_LIST, RedisKeyConstants.MDE_AREA_LIST},
|
|
|
allEntries = true) // allEntries 清空所有缓存,因为操作一个区域,涉及到多个缓存
|
|
|
public void updateArea(AreaSaveReqVO updateReqVO) {
|
|
|
// 校验存在
|
|
@@ -61,7 +60,7 @@ public class AreaServiceImpl implements AreaService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @CacheEvict(cacheNames = RedisKeyConstants.MDE_AREA_CHILDREN_id_LIST,
|
|
|
+ @CacheEvict(cacheNames = {RedisKeyConstants.MDE_AREA_CHILDREN_id_LIST, RedisKeyConstants.MDE_AREA_LIST},
|
|
|
allEntries = true) // allEntries 清空所有缓存,因为操作一个区域,涉及到多个缓存
|
|
|
public void deleteArea(Long id) {
|
|
|
// 校验存在
|
|
@@ -117,7 +116,7 @@ public class AreaServiceImpl implements AreaService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<AppAreaChildrenRespVO> getArea(AreaListReqVO reqVO){
|
|
|
+ public List<AppAreaChildrenRespVO> getArea(AreaListReqVO reqVO) {
|
|
|
List<AreaDO> areaList = areaMapper.selectList(reqVO);
|
|
|
if (null == areaList) {
|
|
|
return null;
|
|
@@ -135,8 +134,9 @@ public class AreaServiceImpl implements AreaService {
|
|
|
|
|
|
/**
|
|
|
* 递归查询子节点
|
|
|
- * @param root 根节点
|
|
|
- * @param all 所有节点
|
|
|
+ *
|
|
|
+ * @param root 根节点
|
|
|
+ * @param all 所有节点
|
|
|
* @return 根节点信息
|
|
|
*/
|
|
|
private List<AppAreaChildrenRespVO> getChildren(AppAreaChildrenRespVO root, List<AppAreaChildrenRespVO> all) {
|
|
@@ -152,6 +152,7 @@ public class AreaServiceImpl implements AreaService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Cacheable(cacheNames = RedisKeyConstants.MDE_AREA_LIST, key = "#reqVO", unless = "#result.size==0")
|
|
|
public List<AppAreaSimpleRespVO> getAreaList(AppAreaListReqVO reqVO) {
|
|
|
return AreaConvert.INSTANCE.convertList2(areaMapper.selectList(reqVO));
|
|
|
}
|