From bd605ac1e79b73db3b501f323d6f4a10c0f27dd5 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期五, 27 六月 2025 15:01:57 +0800
Subject: [PATCH] 部分功能调整

---
 multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
index 7690a1c..379e974 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
@@ -14,7 +14,9 @@
 import com.gkhy.exam.common.utils.RedisUtils;
 import com.gkhy.exam.common.utils.SecurityUtils;
 import com.gkhy.exam.common.utils.StringUtils;
+import com.gkhy.exam.system.domain.SysUserRole;
 import com.gkhy.exam.system.mapper.SysUserMapper;
+import com.gkhy.exam.system.mapper.SysUserRoleMapper;
 import com.gkhy.exam.system.service.SysConfigService;
 import com.gkhy.exam.system.service.SysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +47,8 @@
     private SysConfigService configService;
     @Autowired
     private Validator validator;
+    @Autowired
+    private SysUserRoleMapper userRoleMapper;
 
     @Override
     public CommonPage<SysUser> selectUserList(SysUser user) {
@@ -131,6 +135,13 @@
         user.setCreateBy(SecurityUtils.getUsername());
         user.setPassword(SecurityUtils.encryptPassword(Base64.decodeStr(user.getPassword())));
         int row=baseMapper.insert(user);
+        List<SysUserRole> userRoleList = new ArrayList<>();
+        SysUserRole sysUserRole = new SysUserRole();
+        sysUserRole.setUserId(user.getId());
+        sysUserRole.setRoleId(2L);
+        userRoleList.add(sysUserRole);
+        userRoleMapper.batchUserRole(userRoleList);
+
         if(row<1){
             throw new ApiException("新增用户失败");
         }

--
Gitblit v1.9.2