修正无法修改租户的问题
This commit is contained in:
parent
5e8a8f6cd9
commit
e0e190671f
@ -301,21 +301,21 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean update(SysTenantBo sysTenantBo) {
|
public boolean update(SysTenantBo sysTenantBo) {
|
||||||
|
SysTenant tenant = MapstructUtils.convert(sysTenantBo, SysTenant.class);
|
||||||
|
if (ObjectUtil.isNull(tenant)) {
|
||||||
|
throw new ServiceException("租户的参数为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果更换了套餐,则需要同步套餐sys_role_menu表
|
||||||
|
SysTenantVo oldTenantVo = selectById(tenant.getTenantId());
|
||||||
|
if (!oldTenantVo.getPackageId().equals(tenant.getPackageId())) {
|
||||||
|
boolean synced = syncTenantPackage(tenant.getTenantId(), tenant.getPackageId());
|
||||||
|
if (!synced) {
|
||||||
|
throw new ServiceException("同步套餐失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TenantHelper.ignore(() -> {
|
return TenantHelper.ignore(() -> {
|
||||||
SysTenant tenant = MapstructUtils.convert(sysTenantBo, SysTenant.class);
|
|
||||||
if (ObjectUtil.isNull(tenant)) {
|
|
||||||
throw new ServiceException("租户的参数为空!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//如果更换了套餐,则需要同步套餐sys_role_menu表
|
|
||||||
SysTenantVo oldTenantVo = selectById(tenant.getTenantId());
|
|
||||||
if (!oldTenantVo.getPackageId().equals(tenant.getPackageId())) {
|
|
||||||
boolean synced = syncTenantPackage(tenant.getTenantId(), tenant.getPackageId());
|
|
||||||
if (!synced) {
|
|
||||||
throw new ServiceException("同步套餐失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Long loginUserId = LoginHelper.getUserId();
|
Long loginUserId = LoginHelper.getUserId();
|
||||||
Date createTime = new Date();
|
Date createTime = new Date();
|
||||||
tenant.setUpdateBy(loginUserId);
|
tenant.setUpdateBy(loginUserId);
|
||||||
@ -418,8 +418,8 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
|
|||||||
public boolean syncTenantPackage(Long tenantId, Long packageId) {
|
public boolean syncTenantPackage(Long tenantId, Long packageId) {
|
||||||
return TenantHelper.ignore(() -> {
|
return TenantHelper.ignore(() -> {
|
||||||
SysTenantPackage tenantPackage = tenantPackageMapper.selectOneById(packageId);
|
SysTenantPackage tenantPackage = tenantPackageMapper.selectOneById(packageId);
|
||||||
List<SysRole> roles = TenantHelper.ignore(() -> roleMapper.selectListByQuery(
|
List<SysRole> roles = roleMapper.selectListByQuery(
|
||||||
QueryWrapper.create().from(SYS_ROLE).where(SYS_ROLE.TENANT_ID.eq(tenantId))));
|
QueryWrapper.create().from(SYS_ROLE).where(SYS_ROLE.TENANT_ID.eq(tenantId)));
|
||||||
List<Long> roleIds = new ArrayList<>(roles.size() - 1);
|
List<Long> roleIds = new ArrayList<>(roles.size() - 1);
|
||||||
List<Long> menuIds = StringUtils.splitTo(tenantPackage.getMenuIds(), Convert::toLong);
|
List<Long> menuIds = StringUtils.splitTo(tenantPackage.getMenuIds(), Convert::toLong);
|
||||||
roles.forEach(role -> {
|
roles.forEach(role -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user