|
@@ -1,6 +1,7 @@
|
|
|
package com.usky.system.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.common.core.exception.BusinessException;
|
|
@@ -13,6 +14,7 @@ import com.usky.system.mapper.SysUserTenantMapper;
|
|
|
import com.usky.system.service.SysTenantService;
|
|
|
import com.usky.system.service.SysUserTenantService;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.system.service.vo.TenantPlatformVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -107,4 +109,19 @@ public class SysUserTenantServiceImpl extends AbstractCrudService<SysUserTenantM
|
|
|
List<SysUserTenant> userTenants = this.list(queryWrapper);
|
|
|
return userTenants.get(0).getIsDefault();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void updateUserTenant(SysUserTenant userTenant) {
|
|
|
+ LambdaUpdateWrapper<SysUserTenant> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(SysUserTenant::getIsDefault, 0)
|
|
|
+ .eq(SysUserTenant::getUserId, userTenant.getUserId())
|
|
|
+ .eq(SysUserTenant::getIsDefault, 1);
|
|
|
+ this.update(updateWrapper);
|
|
|
+ LambdaUpdateWrapper<SysUserTenant> updateWrapper1 = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper1.set(SysUserTenant::getIsDefault, 1)
|
|
|
+ .eq(SysUserTenant::getUserId, userTenant.getUserId())
|
|
|
+ .eq(SysUserTenant::getTenantId, userTenant.getTenantId());
|
|
|
+ this.update(updateWrapper1);
|
|
|
+ }
|
|
|
}
|