feat:【system 系统管理】租户支持匹配多域名、微信小程序 appid 等

This commit is contained in:
YunaiV
2025-08-19 22:58:44 +08:00
parent 97a981c294
commit df2ef43f85
17 changed files with 138 additions and 77 deletions

View File

@@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
@@ -42,6 +43,7 @@ import static cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO.PACK
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
@@ -155,7 +157,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactMobile("15601691300");
o.setPackageId(100L);
o.setStatus(randomCommonStatus());
o.setWebsite("https://www.iocoder.cn");
o.setWebsites(singletonList("https://www.iocoder.cn"));
o.setUsername("yunai");
o.setPassword("yuanma");
}).setId(null); // 设置为 null方便后面校验
@@ -183,7 +185,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
TenantSaveReqVO reqVO = randomPojo(TenantSaveReqVO.class, o -> {
o.setId(dbTenant.getId()); // 设置更新的 ID
o.setStatus(randomCommonStatus());
o.setWebsite(randomString());
o.setWebsites(singletonList(randomString()));
});
// mock 套餐
@@ -332,9 +334,10 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
}
@Test
@Disabled // H2 不支持 find_in_set 函数
public void testGetTenantByWebsite() {
// mock 数据
TenantDO dbTenant = randomPojo(TenantDO.class, o -> o.setWebsite("https://www.iocoder.cn"));
TenantDO dbTenant = randomPojo(TenantDO.class, o -> o.setWebsites(singletonList("https://www.iocoder.cn")));
tenantMapper.insert(dbTenant);// @Sql: 先插入出一条存在的数据
// 调用

View File

@@ -390,7 +390,7 @@ CREATE TABLE IF NOT EXISTS "system_tenant" (
"contact_name" varchar(255) NOT NULL,
"contact_mobile" varchar(255),
"status" tinyint NOT NULL,
"website" varchar(63) DEFAULT '',
"websites" varchar(1024) DEFAULT '',
"package_id" bigint NOT NULL,
"expire_time" timestamp NOT NULL,
"account_count" int NOT NULL,