From e2b169e07ae5379e5490363e4d15320b7eb0c59e 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: Wed, 25 Oct 2023 22:18:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8D=E5=8C=BA=E5=88=86=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/web/service/SysRegisterService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java index 013773e50..4d4b07283 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java @@ -1,6 +1,8 @@ package org.dromara.web.service; import cn.dev33.satoken.secure.BCrypt; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.dromara.common.core.constant.Constants; import org.dromara.common.core.constant.GlobalConstants; import org.dromara.common.core.domain.model.RegisterBody; @@ -14,8 +16,11 @@ import org.dromara.common.core.utils.SpringUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.log.event.LogininforEvent; import org.dromara.common.redis.utils.RedisUtils; +import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.common.web.config.properties.CaptchaProperties; +import org.dromara.system.domain.SysUser; import org.dromara.system.domain.bo.SysUserBo; +import org.dromara.system.mapper.SysUserMapper; import org.dromara.system.service.ISysUserService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -30,6 +35,7 @@ import org.springframework.stereotype.Service; public class SysRegisterService { private final ISysUserService userService; + private final SysUserMapper userMapper; private final CaptchaProperties captchaProperties; /** @@ -53,7 +59,11 @@ public class SysRegisterService { sysUser.setPassword(BCrypt.hashpw(password)); sysUser.setUserType(userType); - if (!userService.checkUserNameUnique(sysUser)) { + boolean exist = userMapper.exists(new LambdaQueryWrapper() + .eq(TenantHelper.isEnable(), SysUser::getTenantId, tenantId) + .eq(SysUser::getUserName, sysUser.getUserName()) + .ne(ObjectUtil.isNotNull(sysUser.getUserId()), SysUser::getUserId, sysUser.getUserId())); + if (exist) { throw new UserException("user.register.save.error", username); } boolean regFlag = userService.registerUser(sysUser, tenantId); From c4f69b466a1f44322fe532d24b4a930413fde777 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: Tue, 14 Nov 2023 13:20:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=8F=92=E4=BB=B6=20ignoreTable=20=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E7=A7=9F=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/tenant/handle/PlusTenantLineHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java index aa77e3e63..6c93ee581 100644 --- a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java +++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java @@ -2,15 +2,14 @@ package org.dromara.common.tenant.handle; import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; -import lombok.extern.slf4j.Slf4j; -import org.dromara.common.core.utils.StringUtils; -import org.dromara.common.satoken.utils.LoginHelper; -import org.dromara.common.tenant.helper.TenantHelper; -import org.dromara.common.tenant.properties.TenantProperties; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.NullValue; import net.sf.jsqlparser.expression.StringValue; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.tenant.helper.TenantHelper; +import org.dromara.common.tenant.properties.TenantProperties; import java.util.List; @@ -38,7 +37,7 @@ public class PlusTenantLineHandler implements TenantLineHandler { @Override public boolean ignoreTable(String tableName) { - String tenantId = LoginHelper.getTenantId(); + String tenantId = TenantHelper.getTenantId(); // 判断是否有租户 if (StringUtils.isNotBlank(tenantId)) { // 不需要过滤租户的表 From a5f2c475f896050fab0ec2822b73b75a77cbce04 Mon Sep 17 00:00:00 2001 From: Simple <2424585654@qq.com> Date: Wed, 29 Nov 2023 15:32:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20excel=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=B3=A8=E8=A7=A3=E4=BC=9A=E6=A0=B9=E6=8D=AE=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=88=97=E5=90=88=E5=B9=B6=E7=9A=84=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E6=9D=A5=E5=86=B3=E5=AE=9A=E5=90=8E=E7=BB=AD=E7=9A=84=E5=88=97?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/excel/core/CellMergeStrategy.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java index 08f4dda26..d805ec5f4 100644 --- a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java +++ b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java @@ -93,14 +93,28 @@ public class CellMergeStrategy extends AbstractMergeStrategy { // 空值跳过不合并 continue; } - if (!cellValue.equals(val)) { - if (i - repeatCell.getCurrent() > 1) { - cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum)); + if (j == 0) { + if (!cellValue.equals(val)) { + if (i - repeatCell.getCurrent() > 1) { + cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum)); + } + map.put(field, new RepeatCell(val, i)); + } else if (i == list.size() - 1) { + if (i > repeatCell.getCurrent()) { + cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum)); + } } - map.put(field, new RepeatCell(val, i)); - } else if (i == list.size() - 1) { - if (i > repeatCell.getCurrent()) { - cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum)); + } else { + RepeatCell firstCell = map.get(mergeFields.get(0)); + if (repeatCell.getCurrent() != firstCell.getCurrent()) { + if (i - repeatCell.getCurrent() > 1) { + cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum)); + } + map.put(field, new RepeatCell(val, i)); + } else if (i == list.size() - 1) { + if (i > repeatCell.getCurrent()) { + cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum)); + } } } }