|
|
@@ -15,7 +15,9 @@ import cn.tr.module.sys.tenant.dto.SysTenantAddDTO;
|
|
|
import cn.tr.module.sys.tenant.dto.SysTenantCommonDTO;
|
|
|
import cn.tr.module.sys.tenant.dto.SysTenantQueryDTO;
|
|
|
import cn.tr.module.sys.tenant.mapper.SysTenantMapper;
|
|
|
+import cn.tr.module.sys.tenant.po.SysInviteCodePO;
|
|
|
import cn.tr.module.sys.tenant.po.SysTenantPO;
|
|
|
+import cn.tr.module.sys.tenant.repository.SysInviteCodeRepository;
|
|
|
import cn.tr.module.sys.tenant.repository.SysTenantRepository;
|
|
|
import cn.tr.module.sys.tenant.service.ISysTenantPackageMenuService;
|
|
|
import cn.tr.module.sys.tenant.service.ISysTenantService;
|
|
|
@@ -75,6 +77,8 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
@Lazy
|
|
|
private ISysTenantPackageMenuService tenantPackageMenuService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysInviteCodeRepository inviteCodeRepository;
|
|
|
|
|
|
@Override
|
|
|
@TenantIgnore
|
|
|
@@ -103,6 +107,10 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
validate();
|
|
|
validateSource(source);
|
|
|
SysTenantPO tenant = SysTenantMapper.INSTANCE.toPO(source);
|
|
|
+ SysInviteCodePO inviteCode=inviteCodeRepository.selectRandomOne();
|
|
|
+ tenant.setInviteCode(inviteCode.getCode());
|
|
|
+ inviteCode.setUse(Boolean.TRUE);
|
|
|
+ inviteCodeRepository.updateById(inviteCode);
|
|
|
return tenantRepository.insert(tenant) != 0;
|
|
|
}
|
|
|
|