feat:【system 系统管理】租户支持匹配多域名、微信小程序 appid 等
parent
816e1fbf9b
commit
e792054adb
|
@ -4303,7 +4303,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name varchar(30) NOT NULL,
|
contact_name varchar(30) NOT NULL,
|
||||||
contact_mobile varchar(500) DEFAULT NULL NULL,
|
contact_mobile varchar(500) DEFAULT NULL NULL,
|
||||||
status smallint DEFAULT 0 NOT NULL,
|
status smallint DEFAULT 0 NOT NULL,
|
||||||
website varchar(256) DEFAULT '' NULL,
|
websites varchar(256) DEFAULT '' NULL,
|
||||||
package_id bigint NOT NULL,
|
package_id bigint NOT NULL,
|
||||||
expire_time datetime NOT NULL,
|
expire_time datetime NOT NULL,
|
||||||
account_count int NOT NULL,
|
account_count int NOT NULL,
|
||||||
|
@ -4320,7 +4320,7 @@ COMMENT ON COLUMN system_tenant.contact_user_id IS '联系人的用户编号';
|
||||||
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
||||||
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
||||||
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
||||||
COMMENT ON COLUMN system_tenant.website IS '绑定域名';
|
COMMENT ON COLUMN system_tenant.websites IS '绑定域名数组';
|
||||||
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
||||||
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
||||||
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
||||||
|
@ -4336,9 +4336,9 @@ COMMENT ON TABLE system_tenant IS '租户表';
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- @formatter:off
|
-- @formatter:off
|
||||||
SET IDENTITY_INSERT system_tenant ON;
|
SET IDENTITY_INSERT system_tenant ON;
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
SET IDENTITY_INSERT system_tenant OFF;
|
SET IDENTITY_INSERT system_tenant OFF;
|
||||||
-- @formatter:on
|
-- @formatter:on
|
||||||
|
|
|
@ -4608,7 +4608,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name varchar(30) NOT NULL,
|
contact_name varchar(30) NOT NULL,
|
||||||
contact_mobile varchar(500) NULL DEFAULT NULL,
|
contact_mobile varchar(500) NULL DEFAULT NULL,
|
||||||
status int2 NOT NULL DEFAULT 0,
|
status int2 NOT NULL DEFAULT 0,
|
||||||
website varchar(256) NULL DEFAULT '',
|
websites varchar(256) NULL DEFAULT '',
|
||||||
package_id int8 NOT NULL,
|
package_id int8 NOT NULL,
|
||||||
expire_time timestamp NOT NULL,
|
expire_time timestamp NOT NULL,
|
||||||
account_count int4 NOT NULL,
|
account_count int4 NOT NULL,
|
||||||
|
@ -4628,7 +4628,7 @@ COMMENT ON COLUMN system_tenant.contact_user_id IS '联系人的用户编号';
|
||||||
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
||||||
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
||||||
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
||||||
COMMENT ON COLUMN system_tenant.website IS '绑定域名';
|
COMMENT ON COLUMN system_tenant.websites IS '绑定域名数组';
|
||||||
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
||||||
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
||||||
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
||||||
|
@ -4644,9 +4644,9 @@ COMMENT ON TABLE system_tenant IS '租户表';
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- @formatter:off
|
-- @formatter:off
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- @formatter:on
|
-- @formatter:on
|
||||||
|
|
||||||
|
|
|
@ -3745,7 +3745,7 @@ CREATE TABLE `system_tenant` (
|
||||||
`contact_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '联系人',
|
`contact_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '联系人',
|
||||||
`contact_mobile` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系手机',
|
`contact_mobile` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系手机',
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)',
|
`status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)',
|
||||||
`website` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '绑定域名',
|
`websites` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '绑定域名数组',
|
||||||
`package_id` bigint NOT NULL COMMENT '租户套餐编号',
|
`package_id` bigint NOT NULL COMMENT '租户套餐编号',
|
||||||
`expire_time` datetime NOT NULL COMMENT '过期时间',
|
`expire_time` datetime NOT NULL COMMENT '过期时间',
|
||||||
`account_count` int NOT NULL COMMENT '账号数量',
|
`account_count` int NOT NULL COMMENT '账号数量',
|
||||||
|
@ -3761,9 +3761,9 @@ CREATE TABLE `system_tenant` (
|
||||||
-- Records of system_tenant
|
-- Records of system_tenant
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `website`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', b'0');
|
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `websites`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', b'0');
|
||||||
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `website`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', b'0');
|
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `websites`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', b'0');
|
||||||
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `website`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', b'0');
|
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `websites`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', b'0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
|
@ -4608,7 +4608,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name varchar(30) NOT NULL,
|
contact_name varchar(30) NOT NULL,
|
||||||
contact_mobile varchar(500) NULL DEFAULT NULL,
|
contact_mobile varchar(500) NULL DEFAULT NULL,
|
||||||
status int2 NOT NULL DEFAULT 0,
|
status int2 NOT NULL DEFAULT 0,
|
||||||
website varchar(256) NULL DEFAULT '',
|
websites varchar(256) NULL DEFAULT '',
|
||||||
package_id int8 NOT NULL,
|
package_id int8 NOT NULL,
|
||||||
expire_time timestamp NOT NULL,
|
expire_time timestamp NOT NULL,
|
||||||
account_count int4 NOT NULL,
|
account_count int4 NOT NULL,
|
||||||
|
@ -4628,7 +4628,7 @@ COMMENT ON COLUMN system_tenant.contact_user_id IS '联系人的用户编号';
|
||||||
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
||||||
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
||||||
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
||||||
COMMENT ON COLUMN system_tenant.website IS '绑定域名';
|
COMMENT ON COLUMN system_tenant.websites IS '绑定域名数组';
|
||||||
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
||||||
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
||||||
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
||||||
|
@ -4644,9 +4644,9 @@ COMMENT ON TABLE system_tenant IS '租户表';
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- @formatter:off
|
-- @formatter:off
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- @formatter:on
|
-- @formatter:on
|
||||||
|
|
||||||
|
|
|
@ -4495,7 +4495,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name varchar2(30) NULL,
|
contact_name varchar2(30) NULL,
|
||||||
contact_mobile varchar2(500) DEFAULT NULL NULL,
|
contact_mobile varchar2(500) DEFAULT NULL NULL,
|
||||||
status smallint DEFAULT 0 NOT NULL,
|
status smallint DEFAULT 0 NOT NULL,
|
||||||
website varchar2(256) DEFAULT '' NULL,
|
websites varchar2(256) DEFAULT '' NULL,
|
||||||
package_id number NOT NULL,
|
package_id number NOT NULL,
|
||||||
expire_time date NOT NULL,
|
expire_time date NOT NULL,
|
||||||
account_count number NOT NULL,
|
account_count number NOT NULL,
|
||||||
|
@ -4515,7 +4515,7 @@ COMMENT ON COLUMN system_tenant.contact_user_id IS '联系人的用户编号';
|
||||||
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
||||||
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
||||||
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
||||||
COMMENT ON COLUMN system_tenant.website IS '绑定域名';
|
COMMENT ON COLUMN system_tenant.websites IS '绑定域名数组';
|
||||||
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
||||||
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
||||||
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
||||||
|
@ -4530,9 +4530,9 @@ COMMENT ON TABLE system_tenant IS '租户表';
|
||||||
-- Records of system_tenant
|
-- Records of system_tenant
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- @formatter:off
|
-- @formatter:off
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, to_date('2099-02-19 17:14:16', 'SYYYY-MM-DD HH24:MI:SS'), 9999, '1', to_date('2021-01-05 17:03:47', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2023-11-06 11:41:41', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, to_date('2099-02-19 17:14:16', 'SYYYY-MM-DD HH24:MI:SS'), 9999, '1', to_date('2021-01-05 17:03:47', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2023-11-06 11:41:41', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, to_date('2026-07-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), 30, '1', to_date('2022-02-22 00:56:14', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2025-04-03 21:33:01', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, to_date('2026-07-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), 30, '1', to_date('2022-02-22 00:56:14', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2025-04-03 21:33:01', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, to_date('2022-04-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), 50, '1', to_date('2022-03-07 21:37:58', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2024-09-22 12:10:50', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, to_date('2022-04-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), 50, '1', to_date('2022-03-07 21:37:58', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2024-09-22 12:10:50', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- @formatter:on
|
-- @formatter:on
|
||||||
|
|
||||||
|
|
|
@ -4608,7 +4608,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name varchar(30) NOT NULL,
|
contact_name varchar(30) NOT NULL,
|
||||||
contact_mobile varchar(500) NULL DEFAULT NULL,
|
contact_mobile varchar(500) NULL DEFAULT NULL,
|
||||||
status int2 NOT NULL DEFAULT 0,
|
status int2 NOT NULL DEFAULT 0,
|
||||||
website varchar(256) NULL DEFAULT '',
|
websites varchar(256) NULL DEFAULT '',
|
||||||
package_id int8 NOT NULL,
|
package_id int8 NOT NULL,
|
||||||
expire_time timestamp NOT NULL,
|
expire_time timestamp NOT NULL,
|
||||||
account_count int4 NOT NULL,
|
account_count int4 NOT NULL,
|
||||||
|
@ -4628,7 +4628,7 @@ COMMENT ON COLUMN system_tenant.contact_user_id IS '联系人的用户编号';
|
||||||
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
COMMENT ON COLUMN system_tenant.contact_name IS '联系人';
|
||||||
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
COMMENT ON COLUMN system_tenant.contact_mobile IS '联系手机';
|
||||||
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
COMMENT ON COLUMN system_tenant.status IS '租户状态(0正常 1停用)';
|
||||||
COMMENT ON COLUMN system_tenant.website IS '绑定域名';
|
COMMENT ON COLUMN system_tenant.websites IS '绑定域名数组';
|
||||||
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
COMMENT ON COLUMN system_tenant.package_id IS '租户套餐编号';
|
||||||
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
COMMENT ON COLUMN system_tenant.expire_time IS '过期时间';
|
||||||
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
COMMENT ON COLUMN system_tenant.account_count IS '账号数量';
|
||||||
|
@ -4644,9 +4644,9 @@ COMMENT ON TABLE system_tenant IS '租户表';
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- @formatter:off
|
-- @formatter:off
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2023-11-06 11:41:41', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'zsxq.iocoder.cn', 111, '2026-07-10 00:00:00', 30, '1', '2022-02-22 00:56:14', '1', '2025-04-03 21:33:01', '0');
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'test.iocoder.cn', 111, '2022-04-29 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2024-09-22 12:10:50', '0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- @formatter:on
|
-- @formatter:on
|
||||||
|
|
||||||
|
|
|
@ -10834,7 +10834,7 @@ CREATE TABLE system_tenant
|
||||||
contact_name nvarchar(30) NOT NULL,
|
contact_name nvarchar(30) NOT NULL,
|
||||||
contact_mobile nvarchar(500) DEFAULT NULL NULL,
|
contact_mobile nvarchar(500) DEFAULT NULL NULL,
|
||||||
status tinyint DEFAULT 0 NOT NULL,
|
status tinyint DEFAULT 0 NOT NULL,
|
||||||
website nvarchar(256) DEFAULT '' NULL,
|
websites nvarchar(256) DEFAULT '' NULL,
|
||||||
package_id bigint NOT NULL,
|
package_id bigint NOT NULL,
|
||||||
expire_time datetime2 NOT NULL,
|
expire_time datetime2 NOT NULL,
|
||||||
account_count int NOT NULL,
|
account_count int NOT NULL,
|
||||||
|
@ -10965,11 +10965,11 @@ BEGIN TRANSACTION
|
||||||
GO
|
GO
|
||||||
SET IDENTITY_INSERT system_tenant ON
|
SET IDENTITY_INSERT system_tenant ON
|
||||||
GO
|
GO
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, N'芋道源码', NULL, N'芋艿', N'17321315478', 0, N'www.iocoder.cn', 0, N'2099-02-19 17:14:16', 9999, N'1', N'2021-01-05 17:03:47', N'1', N'2023-11-06 11:41:41', N'0')
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (1, N'芋道源码', NULL, N'芋艿', N'17321315478', 0, N'www.iocoder.cn', 0, N'2099-02-19 17:14:16', 9999, N'1', N'2021-01-05 17:03:47', N'1', N'2023-11-06 11:41:41', N'0')
|
||||||
GO
|
GO
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, N'小租户', 110, N'小王2', N'15601691300', 0, N'zsxq.iocoder.cn', 111, N'2026-07-10 00:00:00', 30, N'1', N'2022-02-22 00:56:14', N'1', N'2025-04-03 21:33:01', N'0')
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (121, N'小租户', 110, N'小王2', N'15601691300', 0, N'zsxq.iocoder.cn', 111, N'2026-07-10 00:00:00', 30, N'1', N'2022-02-22 00:56:14', N'1', N'2025-04-03 21:33:01', N'0')
|
||||||
GO
|
GO
|
||||||
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, website, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, N'测试租户', 113, N'芋道', N'15601691300', 0, N'test.iocoder.cn', 111, N'2022-04-29 00:00:00', 50, N'1', N'2022-03-07 21:37:58', N'1', N'2024-09-22 12:10:50', N'0')
|
INSERT INTO system_tenant (id, name, contact_user_id, contact_name, contact_mobile, status, websites, package_id, expire_time, account_count, creator, create_time, updater, update_time, deleted) VALUES (122, N'测试租户', 113, N'芋道', N'15601691300', 0, N'test.iocoder.cn', 111, N'2022-04-29 00:00:00', 50, N'1', N'2022-03-07 21:37:58', N'1', N'2024-09-22 12:10:50', N'0')
|
||||||
GO
|
GO
|
||||||
SET IDENTITY_INSERT system_tenant OFF
|
SET IDENTITY_INSERT system_tenant OFF
|
||||||
GO
|
GO
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant;
|
package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 租户 Response VO")
|
@Schema(description = "管理后台 - 租户 Response VO")
|
||||||
@Data
|
@Data
|
||||||
|
@ -36,8 +37,8 @@ public class TenantRespVO {
|
||||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "绑定域名", example = "https://www.iocoder.cn")
|
@Schema(description = "绑定域名数组", example = "https://www.iocoder.cn")
|
||||||
private String website;
|
private List<String> websites;
|
||||||
|
|
||||||
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private Long packageId;
|
private Long packageId;
|
||||||
|
|
|
@ -3,14 +3,15 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.AssertTrue;
|
import jakarta.validation.constraints.AssertTrue;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 租户创建/修改 Request VO")
|
@Schema(description = "管理后台 - 租户创建/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
|
@ -34,8 +35,8 @@ public class TenantSaveReqVO {
|
||||||
@NotNull(message = "租户状态")
|
@NotNull(message = "租户状态")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "绑定域名", example = "https://www.iocoder.cn")
|
@Schema(description = "绑定域名数组", example = "https://www.iocoder.cn")
|
||||||
private String website;
|
private List<String> websites;
|
||||||
|
|
||||||
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
@NotNull(message = "租户套餐编号不能为空")
|
@NotNull(message = "租户套餐编号不能为空")
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package cn.iocoder.yudao.module.system.controller.app.tenant;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.app.tenant.vo.AppTenantRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "用户 App - 租户")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/tenant")
|
||||||
|
public class AppTenantController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantService tenantService;
|
||||||
|
|
||||||
|
@GetMapping("/get-by-website")
|
||||||
|
@PermitAll
|
||||||
|
@TenantIgnore
|
||||||
|
@Operation(summary = "使用域名,获得租户信息", description = "根据用户的域名,获得租户信息")
|
||||||
|
@Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn")
|
||||||
|
public CommonResult<AppTenantRespVO> getTenantByWebsite(@RequestParam("website") String website) {
|
||||||
|
TenantDO tenant = tenantService.getTenantByWebsite(website);
|
||||||
|
if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
return success(BeanUtils.toBean(tenant, AppTenantRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.iocoder.yudao.module.system.controller.app.tenant.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "用户 App - 租户 Response VO")
|
||||||
|
@Data
|
||||||
|
public class AppTenantRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -2,13 +2,16 @@ package cn.iocoder.yudao.module.system.dal.dataobject.tenant;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户 DO
|
* 租户 DO
|
||||||
|
@ -60,9 +63,13 @@ public class TenantDO extends BaseDO {
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
/**
|
/**
|
||||||
* 绑定域名
|
* 绑定域名列表
|
||||||
|
*
|
||||||
|
* 1. 考虑到对微信小程序的兼容,也允许传递 appid
|
||||||
|
* 2. 为什么是数组,考虑到管理后台、会员前台都有独立的域名,又或者多个管理后台
|
||||||
*/
|
*/
|
||||||
private String website;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> websites;
|
||||||
/**
|
/**
|
||||||
* 租户套餐编号
|
* 租户套餐编号
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,17 +3,13 @@ package cn.iocoder.yudao.module.system.dal.mysql.tenant;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TenantMapper extends BaseMapperX<TenantDO> {
|
public interface TenantMapper extends BaseMapperX<TenantDO> {
|
||||||
|
|
||||||
|
@ -31,8 +27,9 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
||||||
return selectOne(TenantDO::getName, name);
|
return selectOne(TenantDO::getName, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
default TenantDO selectByWebsite(String website) {
|
default List<TenantDO> selectListByWebsite(String website) {
|
||||||
return selectOne(TenantDO::getWebsite, website);
|
return selectList(new LambdaQueryWrapperX<TenantDO>()
|
||||||
|
.apply(MyBatisUtils.findInSet("websites", website)));
|
||||||
}
|
}
|
||||||
|
|
||||||
default Long selectCountByPackageId(Long packageId) {
|
default Long selectCountByPackageId(Long packageId) {
|
||||||
|
|
|
@ -9,11 +9,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户套餐 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TenantPackageMapper extends BaseMapperX<TenantPackageDO> {
|
public interface TenantPackageMapper extends BaseMapperX<TenantPackageDO> {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.tenant;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
@ -102,7 +101,7 @@ public class TenantServiceImpl implements TenantService {
|
||||||
// 校验租户名称是否重复
|
// 校验租户名称是否重复
|
||||||
validTenantNameDuplicate(createReqVO.getName(), null);
|
validTenantNameDuplicate(createReqVO.getName(), null);
|
||||||
// 校验租户域名是否重复
|
// 校验租户域名是否重复
|
||||||
validTenantWebsiteDuplicate(createReqVO.getWebsite(), null);
|
validTenantWebsiteDuplicate(createReqVO.getWebsites(), null);
|
||||||
// 校验套餐被禁用
|
// 校验套餐被禁用
|
||||||
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(createReqVO.getPackageId());
|
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(createReqVO.getPackageId());
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ public class TenantServiceImpl implements TenantService {
|
||||||
// 校验租户名称是否重复
|
// 校验租户名称是否重复
|
||||||
validTenantNameDuplicate(updateReqVO.getName(), updateReqVO.getId());
|
validTenantNameDuplicate(updateReqVO.getName(), updateReqVO.getId());
|
||||||
// 校验租户域名是否重复
|
// 校验租户域名是否重复
|
||||||
validTenantWebsiteDuplicate(updateReqVO.getWebsite(), updateReqVO.getId());
|
validTenantWebsiteDuplicate(updateReqVO.getWebsites(), updateReqVO.getId());
|
||||||
// 校验套餐被禁用
|
// 校验套餐被禁用
|
||||||
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId());
|
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId());
|
||||||
|
|
||||||
|
@ -175,21 +174,19 @@ public class TenantServiceImpl implements TenantService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validTenantWebsiteDuplicate(String website, Long id) {
|
private void validTenantWebsiteDuplicate(List<String> websites, Long excludeId) {
|
||||||
if (StrUtil.isEmpty(website)) {
|
if (CollUtil.isEmpty(websites)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TenantDO tenant = tenantMapper.selectByWebsite(website);
|
websites.forEach(website -> {
|
||||||
if (tenant == null) {
|
List<TenantDO> tenants = tenantMapper.selectListByWebsite(website);
|
||||||
return;
|
if (excludeId != null) {
|
||||||
}
|
tenants.removeIf(tenant -> tenant.getId().equals(excludeId));
|
||||||
// 如果 id 为空,说明不用比较是否为相同名字的租户
|
}
|
||||||
if (id == null) {
|
if (CollUtil.isNotEmpty(tenants)) {
|
||||||
throw exception(TENANT_WEBSITE_DUPLICATE, website);
|
throw exception(TENANT_WEBSITE_DUPLICATE, website);
|
||||||
}
|
}
|
||||||
if (!tenant.getId().equals(id)) {
|
});
|
||||||
throw exception(TENANT_WEBSITE_DUPLICATE, website);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -263,7 +260,8 @@ public class TenantServiceImpl implements TenantService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TenantDO getTenantByWebsite(String website) {
|
public TenantDO getTenantByWebsite(String website) {
|
||||||
return tenantMapper.selectByWebsite(website);
|
List<TenantDO> tenants = tenantMapper.selectListByWebsite(website);
|
||||||
|
return CollUtil.getFirst(tenants);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
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 cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
import static java.util.Collections.singleton;
|
import static java.util.Collections.singleton;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.mockito.ArgumentMatchers.*;
|
import static org.mockito.ArgumentMatchers.*;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
@ -155,7 +157,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
|
||||||
o.setContactMobile("15601691300");
|
o.setContactMobile("15601691300");
|
||||||
o.setPackageId(100L);
|
o.setPackageId(100L);
|
||||||
o.setStatus(randomCommonStatus());
|
o.setStatus(randomCommonStatus());
|
||||||
o.setWebsite("https://www.iocoder.cn");
|
o.setWebsites(singletonList("https://www.iocoder.cn"));
|
||||||
o.setUsername("yunai");
|
o.setUsername("yunai");
|
||||||
o.setPassword("yuanma");
|
o.setPassword("yuanma");
|
||||||
}).setId(null); // 设置为 null,方便后面校验
|
}).setId(null); // 设置为 null,方便后面校验
|
||||||
|
@ -183,7 +185,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
|
||||||
TenantSaveReqVO reqVO = randomPojo(TenantSaveReqVO.class, o -> {
|
TenantSaveReqVO reqVO = randomPojo(TenantSaveReqVO.class, o -> {
|
||||||
o.setId(dbTenant.getId()); // 设置更新的 ID
|
o.setId(dbTenant.getId()); // 设置更新的 ID
|
||||||
o.setStatus(randomCommonStatus());
|
o.setStatus(randomCommonStatus());
|
||||||
o.setWebsite(randomString());
|
o.setWebsites(singletonList(randomString()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// mock 套餐
|
// mock 套餐
|
||||||
|
@ -332,9 +334,10 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled // H2 不支持 find_in_set 函数
|
||||||
public void testGetTenantByWebsite() {
|
public void testGetTenantByWebsite() {
|
||||||
// mock 数据
|
// 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: 先插入出一条存在的数据
|
tenantMapper.insert(dbTenant);// @Sql: 先插入出一条存在的数据
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
|
|
|
@ -390,7 +390,7 @@ CREATE TABLE IF NOT EXISTS "system_tenant" (
|
||||||
"contact_name" varchar(255) NOT NULL,
|
"contact_name" varchar(255) NOT NULL,
|
||||||
"contact_mobile" varchar(255),
|
"contact_mobile" varchar(255),
|
||||||
"status" tinyint NOT NULL,
|
"status" tinyint NOT NULL,
|
||||||
"website" varchar(63) DEFAULT '',
|
"websites" varchar(1024) DEFAULT '',
|
||||||
"package_id" bigint NOT NULL,
|
"package_id" bigint NOT NULL,
|
||||||
"expire_time" timestamp NOT NULL,
|
"expire_time" timestamp NOT NULL,
|
||||||
"account_count" int NOT NULL,
|
"account_count" int NOT NULL,
|
||||||
|
|
Loading…
Reference in New Issue