From c741d779f28c53650006d3a3f515e91612ce5a51 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Sun, 21 Feb 2021 15:45:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=B8=A5=E9=87=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=91issues/I37PNL=20=E5=BE=AE=E6=9C=8D=E5=8A=A1=E5=8C=96?= =?UTF-8?q?=E5=90=8E-cloud-demo=E9=A1=B9=E7=9B=AE=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=92=8C=E5=AD=97=E5=85=B8=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/system/api/ISysBaseAPI.java | 18 +------------ .../java/org/jeecg/common/api/CommonAPI.java | 21 ++++++++++++--- .../org/jeecg/config/AutoPoiDictConfig.java} | 26 +++++++++---------- 3 files changed, 31 insertions(+), 34 deletions(-) rename jeecg-boot/{jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/AutoPoiDictService.java => jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiDictConfig.java} (77%) diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java index 0694caf2..0caa8643 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java @@ -1,14 +1,11 @@ package org.jeecg.common.system.api; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.jeecg.common.api.CommonAPI; import org.jeecg.common.api.dto.OnlineAuthDTO; import org.jeecg.common.api.dto.message.*; import org.jeecg.common.system.vo.*; -import java.util.Arrays; import java.util.List; import java.util.Set; @@ -80,12 +77,7 @@ public interface ISysBaseAPI extends CommonAPI { */ List getDepartNamesByUsername(String username); - /** - * 10获取数据字典 - * @param code - * @return - */ - public List queryDictItemsByCode(String code); + /** 11查询所有的父级字典,按照create_time排序 */ public List queryAllDict(); @@ -96,14 +88,6 @@ public interface ISysBaseAPI extends CommonAPI { */ public List queryAllDSysCategory(); - /** - * 13获取表数据字典 - * @param table - * @param text - * @param code - * @return - */ - List queryTableDictItemsByCode(String table, String text, String code); /** * 14查询所有部门 作为字典信息 id -->value,departName -->text diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java index cfd2e6b1..5a7665cd 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/CommonAPI.java @@ -1,9 +1,6 @@ package org.jeecg.common.api; -import org.jeecg.common.system.vo.DynamicDataSourceModel; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.system.vo.SysPermissionDataRuleModel; -import org.jeecg.common.system.vo.SysUserCacheInfo; +import org.jeecg.common.system.vo.*; import java.util.List; import java.util.Set; @@ -81,4 +78,20 @@ public interface CommonAPI { */ SysUserCacheInfo getCacheUser(String username); + /** + * 10获取数据字典 + * @param code + * @return + */ + public List queryDictItemsByCode(String code); + + /** + * 13获取表数据字典 + * @param table + * @param text + * @param code + * @return + */ + List queryTableDictItemsByCode(String table, String text, String code); + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/AutoPoiDictService.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiDictConfig.java similarity index 77% rename from jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/AutoPoiDictService.java rename to jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiDictConfig.java index b60e12aa..d56f7b47 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/AutoPoiDictService.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/AutoPoiDictConfig.java @@ -1,17 +1,16 @@ -package org.jeecg.modules.system.service.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +package org.jeecg.config; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.CommonAPI; import org.jeecg.common.system.vo.DictModel; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.system.mapper.SysDictMapper; import org.jeecgframework.dict.service.AutoPoiDictServiceI; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; -import lombok.extern.slf4j.Slf4j; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; /** * 描述:AutoPoi Excel注解支持字典参数设置 @@ -25,9 +24,10 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j @Service -public class AutoPoiDictService implements AutoPoiDictServiceI { - @Autowired - private SysDictMapper sysDictMapper; +public class AutoPoiDictConfig implements AutoPoiDictServiceI { + @Lazy + @Resource + private CommonAPI commonAPI; /** * 通过字典查询easypoi,所需字典文本 @@ -42,11 +42,11 @@ public class AutoPoiDictService implements AutoPoiDictServiceI { List dictList = null; // step.1 如果没有字典表则使用系统字典表 if (oConvertUtils.isEmpty(dicTable)) { - dictList = sysDictMapper.queryDictItemsByCode(dicCode); + dictList = commonAPI.queryDictItemsByCode(dicCode); } else { try { dicText = oConvertUtils.getString(dicText, dicCode); - dictList = sysDictMapper.queryTableDictItemsByCode(dicTable, dicText, dicCode); + dictList = commonAPI.queryTableDictItemsByCode(dicTable, dicText, dicCode); } catch (Exception e) { log.error(e.getMessage(),e); } -- GitLab