Commit 4bf7eb73030e7d5bb05dc9ef252401f8af6fede1

Authored by zhangdaiscott
1 parent 5008ebdf

【严重问题】issues/I37PNL 微服务化后-cloud-demo项目导出无法和字典关联

jeecg-boot/jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java
1 package org.jeecg.common.system.api; 1 package org.jeecg.common.system.api;
2 2
3 -import com.alibaba.fastjson.JSON;  
4 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
5 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;  
6 import org.jeecg.common.api.CommonAPI; 4 import org.jeecg.common.api.CommonAPI;
7 import org.jeecg.common.api.dto.OnlineAuthDTO; 5 import org.jeecg.common.api.dto.OnlineAuthDTO;
8 import org.jeecg.common.api.dto.message.*; 6 import org.jeecg.common.api.dto.message.*;
9 import org.jeecg.common.system.vo.*; 7 import org.jeecg.common.system.vo.*;
10 8
11 -import java.util.Arrays;  
12 import java.util.List; 9 import java.util.List;
13 import java.util.Set; 10 import java.util.Set;
14 11
@@ -80,12 +77,7 @@ public interface ISysBaseAPI extends CommonAPI { @@ -80,12 +77,7 @@ public interface ISysBaseAPI extends CommonAPI {
80 */ 77 */
81 List<String> getDepartNamesByUsername(String username); 78 List<String> getDepartNamesByUsername(String username);
82 79
83 - /**  
84 - * 10获取数据字典  
85 - * @param code  
86 - * @return  
87 - */  
88 - public List<DictModel> queryDictItemsByCode(String code); 80 +
89 81
90 /** 11查询所有的父级字典,按照create_time排序 */ 82 /** 11查询所有的父级字典,按照create_time排序 */
91 public List<DictModel> queryAllDict(); 83 public List<DictModel> queryAllDict();
@@ -96,14 +88,6 @@ public interface ISysBaseAPI extends CommonAPI { @@ -96,14 +88,6 @@ public interface ISysBaseAPI extends CommonAPI {
96 */ 88 */
97 public List<SysCategoryModel> queryAllDSysCategory(); 89 public List<SysCategoryModel> queryAllDSysCategory();
98 90
99 - /**  
100 - * 13获取表数据字典  
101 - * @param table  
102 - * @param text  
103 - * @param code  
104 - * @return  
105 - */  
106 - List<DictModel> queryTableDictItemsByCode(String table, String text, String code);  
107 91
108 /** 92 /**
109 * 14查询所有部门 作为字典信息 id -->value,departName -->text 93 * 14查询所有部门 作为字典信息 id -->value,departName -->text
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java
1 package org.jeecg.common.api; 1 package org.jeecg.common.api;
2 2
3 -import org.jeecg.common.system.vo.DynamicDataSourceModel;  
4 -import org.jeecg.common.system.vo.LoginUser;  
5 -import org.jeecg.common.system.vo.SysPermissionDataRuleModel;  
6 -import org.jeecg.common.system.vo.SysUserCacheInfo; 3 +import org.jeecg.common.system.vo.*;
7 4
8 import java.util.List; 5 import java.util.List;
9 import java.util.Set; 6 import java.util.Set;
@@ -81,4 +78,20 @@ public interface CommonAPI { @@ -81,4 +78,20 @@ public interface CommonAPI {
81 */ 78 */
82 SysUserCacheInfo getCacheUser(String username); 79 SysUserCacheInfo getCacheUser(String username);
83 80
  81 + /**
  82 + * 10获取数据字典
  83 + * @param code
  84 + * @return
  85 + */
  86 + public List<DictModel> queryDictItemsByCode(String code);
  87 +
  88 + /**
  89 + * 13获取表数据字典
  90 + * @param table
  91 + * @param text
  92 + * @param code
  93 + * @return
  94 + */
  95 + List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
  96 +
84 } 97 }
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/AutoPoiDictService.java renamed to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiDictConfig.java
1 -package org.jeecg.modules.system.service.impl;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -import java.util.Map; 1 +package org.jeecg.config;
6 2
  3 +import lombok.extern.slf4j.Slf4j;
  4 +import org.jeecg.common.api.CommonAPI;
7 import org.jeecg.common.system.vo.DictModel; 5 import org.jeecg.common.system.vo.DictModel;
8 import org.jeecg.common.util.oConvertUtils; 6 import org.jeecg.common.util.oConvertUtils;
9 -import org.jeecg.modules.system.mapper.SysDictMapper;  
10 import org.jeecgframework.dict.service.AutoPoiDictServiceI; 7 import org.jeecgframework.dict.service.AutoPoiDictServiceI;
11 -import org.springframework.beans.factory.annotation.Autowired; 8 +import org.springframework.context.annotation.Lazy;
12 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
13 10
14 -import lombok.extern.slf4j.Slf4j; 11 +import javax.annotation.Resource;
  12 +import java.util.ArrayList;
  13 +import java.util.List;
15 14
16 /** 15 /**
17 * 描述:AutoPoi Excel注解支持字典参数设置 16 * 描述:AutoPoi Excel注解支持字典参数设置
@@ -25,9 +24,10 @@ import lombok.extern.slf4j.Slf4j; @@ -25,9 +24,10 @@ import lombok.extern.slf4j.Slf4j;
25 */ 24 */
26 @Slf4j 25 @Slf4j
27 @Service 26 @Service
28 -public class AutoPoiDictService implements AutoPoiDictServiceI {  
29 - @Autowired  
30 - private SysDictMapper sysDictMapper; 27 +public class AutoPoiDictConfig implements AutoPoiDictServiceI {
  28 + @Lazy
  29 + @Resource
  30 + private CommonAPI commonAPI;
31 31
32 /** 32 /**
33 * 通过字典查询easypoi,所需字典文本 33 * 通过字典查询easypoi,所需字典文本
@@ -42,11 +42,11 @@ public class AutoPoiDictService implements AutoPoiDictServiceI { @@ -42,11 +42,11 @@ public class AutoPoiDictService implements AutoPoiDictServiceI {
42 List<DictModel> dictList = null; 42 List<DictModel> dictList = null;
43 // step.1 如果没有字典表则使用系统字典表 43 // step.1 如果没有字典表则使用系统字典表
44 if (oConvertUtils.isEmpty(dicTable)) { 44 if (oConvertUtils.isEmpty(dicTable)) {
45 - dictList = sysDictMapper.queryDictItemsByCode(dicCode); 45 + dictList = commonAPI.queryDictItemsByCode(dicCode);
46 } else { 46 } else {
47 try { 47 try {
48 dicText = oConvertUtils.getString(dicText, dicCode); 48 dicText = oConvertUtils.getString(dicText, dicCode);
49 - dictList = sysDictMapper.queryTableDictItemsByCode(dicTable, dicText, dicCode); 49 + dictList = commonAPI.queryTableDictItemsByCode(dicTable, dicText, dicCode);
50 } catch (Exception e) { 50 } catch (Exception e) {
51 log.error(e.getMessage(),e); 51 log.error(e.getMessage(),e);
52 } 52 }