From 7d9733a9fe0e21efe346787838aa5182633e30d2 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 08 十月 2023 22:33:10 +0800
Subject: [PATCH] 注意更新blade-core-tool.jar
---
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
index b4b22d4..799420e 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/TenantServiceImpl.java
@@ -16,10 +16,12 @@
*/
package com.vci.ubcs.system.service.impl;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.vci.ubcs.system.cache.NacosConfigCache;
import com.vci.ubcs.system.entity.*;
import com.vci.ubcs.system.mapper.TenantMapper;
import com.vci.ubcs.system.service.*;
@@ -57,6 +59,11 @@
@Service
@RequiredArgsConstructor
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {
+
+ /**
+ * nacos涓婇厤缃殑瓒呯绉熸埛
+ */
+ private final NacosConfigCache nacosConfigCache;
private final TenantId tenantId;
private final IRoleService roleService;
@@ -198,12 +205,42 @@
return tenantTemp;
}
+ /**
+ * 鑾峰彇绉熸埛淇℃伅锛岄敭鍊煎褰㈠紡锛岀櫥褰曠晫闈㈣皟鐢�
+ * @return
+ */
@Override
public List<Map<String,Object>> selectMaps(){
- List<Map<String, Object>> maps = listMaps(new QueryWrapper<Tenant>().select("TENANT_ID", "TENANT_NAME"));
- return maps;
+ List<Map<String, Object>> mapList = listMaps(new QueryWrapper<Tenant>().select("TENANT_ID", "TENANT_NAME"));
+ if(Func.isNotEmpty(nacosConfigCache.getAdminUserInfo().getTenantId()) && !this.containsSameKeys(mapList,nacosConfigCache.getAdminUserInfo().getTenantId())){
+ Map<String, Object> map = new HashMap<>();
+ map.put("TENANT_ID",nacosConfigCache.getAdminUserInfo().getTenantId());
+ map.put("TENANT_NAME","绠$悊缁�");
+ mapList.add(0,map);
+ }
+ return mapList;
}
+ /**
+ * 鍒ゆ柇鏁版嵁搴撲腑鏄惁瀛樺湪浜庨厤缃枃浠朵腑涓�鑷寸殑瓒呯淇℃伅
+ * @param collection
+ * @param value
+ * @return
+ */
+ private boolean containsSameKeys(List<Map<String, Object>> collection, String value) {
+ for (Map<String, Object> map : collection) {
+ Collection<Object> values = map.values();
+ if (values.contains(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 涓夊憳鐩稿叧閰嶇疆
+ * @return
+ */
@Override
public boolean findIsOpen() {
return this.ssaEnable;
--
Gitblit v1.9.3