From f64b17b548532dc1857e14cd28300c9b07d931c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Sat, 19 Oct 2024 14:51:35 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=20=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysTenantServiceImpl.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java index 80254127..74765498 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java @@ -1,6 +1,7 @@ package org.dromara.system.service.impl; import cn.dev33.satoken.secure.BCrypt; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; @@ -413,33 +414,36 @@ public class SysTenantServiceImpl implements ISysTenantService { Map map = StreamUtils.toIdentityMap(dataListTenant, SysDictData::getDictValue); for (SysDictData dictData : dataList) { if (!map.containsKey(dictData.getDictValue())) { + SysDictData data = BeanUtil.toBean(dictData, SysDictData.class); // 设置字典编码为 null - dictData.setDictCode(null); - dictData.setTenantId(tenantId); - dictData.setCreateTime(null); - dictData.setUpdateTime(null); + data.setDictCode(null); + data.setTenantId(tenantId); + data.setCreateTime(null); + data.setUpdateTime(null); set.add(tenantId); - saveDataList.add(dictData); + saveDataList.add(data); } } } else { - dictType.setDictId(null); - dictType.setTenantId(tenantId); - dictType.setCreateTime(null); - dictType.setUpdateTime(null); + SysDictType type = BeanUtil.toBean(dictType, SysDictType.class); + type.setDictId(null); + type.setTenantId(tenantId); + type.setCreateTime(null); + type.setUpdateTime(null); set.add(tenantId); - saveTypeList.add(dictType); + saveTypeList.add(type); if (CollUtil.isNotEmpty(dataList)) { // 筛选出 dictType 对应的 data for (SysDictData dictData : dataList) { + SysDictData data = BeanUtil.toBean(dictData, SysDictData.class); // 设置字典编码为 null - dictData.setDictCode(null); - dictData.setTenantId(tenantId); - dictData.setCreateTime(null); - dictData.setUpdateTime(null); + data.setDictCode(null); + data.setTenantId(tenantId); + data.setCreateTime(null); + data.setUpdateTime(null); set.add(tenantId); + saveDataList.add(data); } - saveDataList.addAll(dataList); } } }