Commit 6e63c620 authored by fangxinjiang's avatar fangxinjiang

excel导入导出组件

parent 4de7b702
...@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -46,4 +47,6 @@ public interface SysAreaService extends IService<SysArea> { ...@@ -46,4 +47,6 @@ public interface SysAreaService extends IService<SysArea> {
**/ **/
R<Map<String, String>> getAreaToName(); R<Map<String, String>> getAreaToName();
List<SysArea> getAllArea();
} }
...@@ -50,6 +50,11 @@ public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> impl ...@@ -50,6 +50,11 @@ public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> impl
return R.ok(resultMap); return R.ok(resultMap);
} }
@Override
public List<SysArea> getAllArea() {
return baseMapper.selectList(Wrappers.<SysArea>query().lambda());
}
private Map<String, String> getStringMapMap(boolean type) { private Map<String, String> getStringMapMap(boolean type) {
List<SysArea> allList = baseMapper.selectList(Wrappers.<SysArea>query().lambda() List<SysArea> allList = baseMapper.selectList(Wrappers.<SysArea>query().lambda()
.eq(SysArea::getStatus, CommonConstants.ZERO_INT)); .eq(SysArea::getStatus, CommonConstants.ZERO_INT));
......
package com.yifu.cloud.plus.v1.yifu.admin.init; package com.yifu.cloud.plus.v1.yifu.admin.init;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -8,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -22,6 +26,9 @@ public class DictItemRedisInit { ...@@ -22,6 +26,9 @@ public class DictItemRedisInit {
@Autowired @Autowired
private SysDictItemService dictItemService; private SysDictItemService dictItemService;
@Autowired
private SysAreaService sysAreaService;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
...@@ -35,5 +42,16 @@ public class DictItemRedisInit { ...@@ -35,5 +42,16 @@ public class DictItemRedisInit {
} }
} }
log.info("字典数据加入缓存初始化结束..."); log.info("字典数据加入缓存初始化结束...");
log.info("区域数据加入缓存初始化开始...");
List<SysArea> allAreas = sysAreaService.getAllArea();
if (Common.isNotNull(allAreas)){
for (SysArea area:allAreas){
redisUtil.set(area.getId()
+ CommonConstants.DOWN_LINE_STRING
+(Common.isEmpty(area.getParentId())?"0":area.getParentId()),area.getId());
}
}
log.info("区域数据加入缓存初始化结束...");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment