|
@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
@ -95,7 +96,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
|
|
@Transactional |
|
|
public Long createTenant(TenantCreateReqVO createReqVO) { |
|
|
public Long createTenant(TenantCreateReqVO createReqVO) { |
|
|
// 校验租户名称是否重复
|
|
|
// 校验租户名称是否重复
|
|
|
validTenantNameDuplicate(createReqVO.getName(), null); |
|
|
validTenantNameDuplicate(createReqVO.getName(), null); |
|
@ -137,7 +138,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@DSTransactional |
|
|
@Transactional |
|
|
public void updateTenant(TenantUpdateReqVO updateReqVO) { |
|
|
public void updateTenant(TenantUpdateReqVO updateReqVO) { |
|
|
// 校验存在
|
|
|
// 校验存在
|
|
|
TenantDO tenant = validateUpdateTenant(updateReqVO.getId()); |
|
|
TenantDO tenant = validateUpdateTenant(updateReqVO.getId()); |
|
@ -170,7 +171,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@DSTransactional |
|
|
@Transactional |
|
|
public void updateTenantRoleMenu(Long tenantId, Set<Long> menuIds) { |
|
|
public void updateTenantRoleMenu(Long tenantId, Set<Long> menuIds) { |
|
|
TenantUtils.execute(tenantId, () -> { |
|
|
TenantUtils.execute(tenantId, () -> { |
|
|
// 获得所有角色
|
|
|
// 获得所有角色
|
|
|