refactor(system): 删除TenantServiceImpl中多余的userId更新逻辑

- 删除了对company和tenant的userId更新代码
- 简化了superAdmin用户保存后的逻辑
- 优化了代码结构,提升可读性和维护性
This commit is contained in:
2026-04-26 14:24:59 +08:00
parent f894c53184
commit e2520001c9

View File

@@ -152,18 +152,6 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
boolean result = userService.save(superAdmin);
Integer superAdminUserId = superAdmin.getUserId();
// 更新 company 和 tenant 的 userId
if (superAdminUserId != null && superAdminUserId > 0) {
company.setUserId(superAdminUserId);
companyService.updateById(company);
// 同时更新 tenant 的 userId
Tenant tenant = baseMapper.selectById(company.getTid());
if (tenant != null) {
tenant.setUserId(superAdminUserId);
baseMapper.updateById(tenant);
}
}
// 创建角色
if (result) {
Role role = new Role();