!720 1. 完善达梦的兼容性;2. 增加域名解析租户编号

Merge pull request !720 from 芋道源码/feature/dameng
This commit is contained in:
芋道源码 2023-11-06 11:57:57 +00:00 committed by Gitee
commit d48a236d4c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
20 changed files with 112 additions and 115 deletions

View File

@ -3941,7 +3941,7 @@ CREATE TABLE "RUOYI_VUE_PRO"."SYSTEM_TENANT"
"CONTACT_MOBILE" VARCHAR(500) NULL,
"STATUS" TINYINT DEFAULT 0
NOT NULL,
"DOMAIN" VARCHAR(256) DEFAULT ''
"WEBSITE" VARCHAR(256) DEFAULT ''
NULL,
"PACKAGE_ID" BIGINT NOT NULL,
"EXPIRE_TIME" TIMESTAMP(0) NOT NULL,
@ -4943,9 +4943,9 @@ SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_SOCIAL_USER" OFF;
SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_SOCIAL_USER_BIND" ON;
SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_SOCIAL_USER_BIND" OFF;
SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_TENANT" ON;
INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_TENANT"("ID","NAME","CONTACT_USER_ID","CONTACT_NAME","CONTACT_MOBILE","STATUS","DOMAIN","PACKAGE_ID","EXPIRE_TIME","ACCOUNT_COUNT","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(1,'芋道源码',null,'芋艿','17321315478',0,'https://www.iocoder.cn',0,'2099-02-19 17:14:16',9999,'1','2021-01-05 17:03:47','1','2022-02-23 12:15:11',0);
INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_TENANT"("ID","NAME","CONTACT_USER_ID","CONTACT_NAME","CONTACT_MOBILE","STATUS","DOMAIN","PACKAGE_ID","EXPIRE_TIME","ACCOUNT_COUNT","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(121,'小租户',110,'小王2','15601691300',0,'http://www.iocoder.cn',111,'2024-03-11 00:00:00',20,'1','2022-02-22 00:56:14','1','2022-05-17 10:03:59',0);
INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_TENANT"("ID","NAME","CONTACT_USER_ID","CONTACT_NAME","CONTACT_MOBILE","STATUS","DOMAIN","PACKAGE_ID","EXPIRE_TIME","ACCOUNT_COUNT","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(122,'测试租户',113,'芋道','15601691300',0,'https://www.iocoder.cn',111,'2022-04-30 00:00:00',50,'1','2022-03-07 21:37:58','1','2022-03-07 21:37:58',0);
INSERT INTO "RUOYI_VUE_PRO"."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,'https://www.iocoder.cn',0,'2099-02-19 17:14:16',9999,'1','2021-01-05 17:03:47','1','2022-02-23 12:15:11',0);
INSERT INTO "RUOYI_VUE_PRO"."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,'http://www.iocoder.cn',111,'2024-03-11 00:00:00',20,'1','2022-02-22 00:56:14','1','2022-05-17 10:03:59',0);
INSERT INTO "RUOYI_VUE_PRO"."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,'https://www.iocoder.cn',111,'2022-04-30 00:00:00',50,'1','2022-03-07 21:37:58','1','2022-03-07 21:37:58',0);
SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_TENANT" OFF;
SET IDENTITY_INSERT "RUOYI_VUE_PRO"."SYSTEM_TENANT_PACKAGE" ON;
@ -5674,7 +5674,7 @@ COMMENT ON COLUMN "RUOYI_VUE_PRO"."SYSTEM_TENANT"."CONTACT_MOBILE" IS '联系手
COMMENT ON COLUMN "RUOYI_VUE_PRO"."SYSTEM_TENANT"."STATUS" IS '租户状态0正常 1停用';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."SYSTEM_TENANT"."DOMAIN" IS '绑定域名';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."SYSTEM_TENANT"."WEBSITE" IS '绑定域名';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."SYSTEM_TENANT"."PACKAGE_ID" IS '租户套餐编号';

View File

@ -1,74 +0,0 @@
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder');
CREATE TABLE promotion_diy_template
(
id bigint AUTO_INCREMENT COMMENT '装修模板编号'
PRIMARY KEY,
name varchar(100) NOT NULL COMMENT '模板名称',
used bit DEFAULT b'0' NOT NULL COMMENT '是否使用',
used_time datetime NULL COMMENT '使用时间',
remark varchar(255) NULL COMMENT '备注',
preview_image_urls varchar(2000) NULL COMMENT '预览图多个逗号分隔',
property text NULL COMMENT '页面属性JSON 格式',
creator varchar(64) DEFAULT '' NULL COMMENT '创建者',
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
updater varchar(64) DEFAULT '' NULL COMMENT '更新者',
update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除',
tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号'
)
COMMENT '装修模板';
CREATE TABLE promotion_diy_page
(
id bigint AUTO_INCREMENT COMMENT '装修页面编号'
PRIMARY KEY,
template_id bigint NULL COMMENT '装修模板编号',
name varchar(100) NOT NULL COMMENT '页面名称',
remark varchar(255) NULL COMMENT '备注',
preview_image_urls varchar(2000) NULL COMMENT '预览图多个逗号分隔',
property text NULL COMMENT '页面属性JSON 格式',
creator varchar(64) DEFAULT '' NULL COMMENT '创建者',
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
updater varchar(64) DEFAULT '' NULL COMMENT '更新者',
update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除',
tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号'
)
COMMENT '装修页面';
CREATE INDEX idx_template_id ON promotion_diy_page (template_id);
-- 装修上级菜单营销中心
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
VALUES ('商城装修', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate');
SELECT @diyParentId := LAST_INSERT_ID();
-- 装修模板
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
VALUES ('装修模板', '', 2, 1, @diyParentId, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate');
SELECT @parentId := LAST_INSERT_ID();
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修模板查询', 'promotion:diy-template:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修模板创建', 'promotion:diy-template:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修模板更新', 'promotion:diy-template:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修模板删除', 'promotion:diy-template:delete', 3, 4, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修模板使用', 'promotion:diy-template:use', 3, 5, @parentId, '', '', '', 0);
-- 装修页面
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
VALUES ('装修页面', '', 2, 2, @diyParentId, 'diy-page', 'foundation:page-edit', 'mall/promotion/diy/page/index', 0, 'DiyPage');
SELECT @parentId := LAST_INSERT_ID();
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修页面查询', 'promotion:diy-page:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修页面创建', 'promotion:diy-page:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修页面更新', 'promotion:diy-page:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('装修页面删除', 'promotion:diy-page:delete', 3, 4, @parentId, '', '', '', 0);;

View File

@ -60,8 +60,8 @@ CREATE TABLE `pay_demo_transfer` (
) ENGINE = InnoDB COMMENT = '示例业务转账订单';
ALTER TABLE `pay_channel`
MODIFY COLUMN `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置' AFTER `app_id`;
-- ALTER TABLE `pay_channel`
-- MODIFY COLUMN `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置' AFTER `app_id`;
-- ----------------------------
-- 充值套餐表
@ -245,4 +245,4 @@ INSERT INTO system_menu(
VALUES (
'转账订单', '', 2, 3, 1117,
'transfer', 'ep:credit-card', 'pay/transfer/index', 0, 'PayTransfer'
);
);

View File

@ -3787,7 +3787,7 @@ CREATE TABLE `system_tenant` (
`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 '联系手机',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态0正常 1停用',
`domain` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '绑定域名',
`website` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '绑定域名',
`package_id` bigint NOT NULL COMMENT '租户套餐编号',
`expire_time` datetime NOT NULL COMMENT '过期时间',
`account_count` int NOT NULL COMMENT '账号数量',
@ -3803,9 +3803,9 @@ CREATE TABLE `system_tenant` (
-- Records of system_tenant
-- ----------------------------
BEGIN;
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `domain`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'https://www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2022-02-23 12:15:11', b'0');
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `domain`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, '小租户', 110, '小王2', '15601691300', 0, 'http://www.iocoder.cn', 111, '2024-03-11 00:00:00', 20, '1', '2022-02-22 00:56:14', '1', '2023-09-16 16:59:42', b'0');
INSERT INTO `system_tenant` (`id`, `name`, `contact_user_id`, `contact_name`, `contact_mobile`, `status`, `domain`, `package_id`, `expire_time`, `account_count`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, '测试租户', 113, '芋道', '15601691300', 0, 'https://www.iocoder.cn', 111, '2022-04-30 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2023-09-16 16:59:27', 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 (1, '芋道源码', NULL, '芋艿', '17321315478', 0, 'https://www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1', '2021-01-05 17:03:47', '1', '2022-02-23 12:15:11', 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, 'http://www.iocoder.cn', 111, '2024-03-11 00:00:00', 20, '1', '2022-02-22 00:56:14', '1', '2023-09-16 16:59:42', 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, 'https://www.iocoder.cn', 111, '2022-04-30 00:00:00', 50, '1', '2022-03-07 21:37:58', '1', '2023-09-16 16:59:27', b'0');
COMMIT;
-- ----------------------------

View File

@ -4178,7 +4178,7 @@ CREATE TABLE "SYSTEM_TENANT" (
"CONTACT_NAME" NVARCHAR2(30),
"CONTACT_MOBILE" NVARCHAR2(500),
"STATUS" NUMBER(4,0) NOT NULL,
"DOMAIN" NVARCHAR2(256),
"WEBSITE" NVARCHAR2(256),
"PACKAGE_ID" NUMBER(20,0) NOT NULL,
"EXPIRE_TIME" DATE NOT NULL,
"ACCOUNT_COUNT" NUMBER(11,0) NOT NULL,
@ -4211,7 +4211,7 @@ COMMENT ON COLUMN "SYSTEM_TENANT"."CONTACT_USER_ID" IS '联系人的用户编号
COMMENT ON COLUMN "SYSTEM_TENANT"."CONTACT_NAME" IS '联系人';
COMMENT ON COLUMN "SYSTEM_TENANT"."CONTACT_MOBILE" IS '联系手机';
COMMENT ON COLUMN "SYSTEM_TENANT"."STATUS" IS '租户状态0正常 1停用';
COMMENT ON COLUMN "SYSTEM_TENANT"."DOMAIN" IS '绑定域名';
COMMENT ON COLUMN "SYSTEM_TENANT"."WEBSITE" IS '绑定域名';
COMMENT ON COLUMN "SYSTEM_TENANT"."PACKAGE_ID" IS '租户套餐编号';
COMMENT ON COLUMN "SYSTEM_TENANT"."EXPIRE_TIME" IS '过期时间';
COMMENT ON COLUMN "SYSTEM_TENANT"."ACCOUNT_COUNT" IS '账号数量';
@ -4225,9 +4225,9 @@ COMMENT ON TABLE "SYSTEM_TENANT" IS '租户表';
-- ----------------------------
-- Records of SYSTEM_TENANT
-- ----------------------------
INSERT INTO "SYSTEM_TENANT" ("ID", "NAME", "CONTACT_USER_ID", "CONTACT_NAME", "CONTACT_MOBILE", "STATUS", "DOMAIN", "PACKAGE_ID", "EXPIRE_TIME", "ACCOUNT_COUNT", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED") VALUES ('1', '芋道源码', NULL, '芋艿', '17321315478', '0', 'https://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('2022-02-23 12:15:11', 'SYYYY-MM-DD HH24:MI:SS'), '0');
INSERT INTO "SYSTEM_TENANT" ("ID", "NAME", "CONTACT_USER_ID", "CONTACT_NAME", "CONTACT_MOBILE", "STATUS", "DOMAIN", "PACKAGE_ID", "EXPIRE_TIME", "ACCOUNT_COUNT", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED") VALUES ('121', '小租户', '110', '小王2', '15601691300', '0', 'http://www.iocoder.cn', '111', TO_DATE('2024-03-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), '20', '1', TO_DATE('2022-02-22 00:56:14', 'SYYYY-MM-DD HH24:MI:SS'), '1', TO_DATE('2022-03-19 18:37:20', 'SYYYY-MM-DD HH24:MI:SS'), '0');
INSERT INTO "SYSTEM_TENANT" ("ID", "NAME", "CONTACT_USER_ID", "CONTACT_NAME", "CONTACT_MOBILE", "STATUS", "DOMAIN", "PACKAGE_ID", "EXPIRE_TIME", "ACCOUNT_COUNT", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED") VALUES ('122', '测试租户', '113', '芋道', '15601691300', '0', 'https://www.iocoder.cn', '111', TO_DATE('2022-04-30 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('2022-03-07 21:37:58', '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 ('1', '芋道源码', NULL, '芋艿', '17321315478', '0', 'https://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('2022-02-23 12:15:11', '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', 'http://www.iocoder.cn', '111', TO_DATE('2024-03-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'), '20', '1', TO_DATE('2022-02-22 00:56:14', 'SYYYY-MM-DD HH24:MI:SS'), '1', TO_DATE('2022-03-19 18:37:20', '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', 'https://www.iocoder.cn', '111', TO_DATE('2022-04-30 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('2022-03-07 21:37:58', 'SYYYY-MM-DD HH24:MI:SS'), '0');
COMMIT;
COMMIT;

View File

@ -6779,7 +6779,7 @@ CREATE TABLE "system_tenant"
"contact_name" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
"contact_mobile" varchar(500) COLLATE "pg_catalog"."default",
"status" int2 NOT NULL,
"domain" varchar(256) COLLATE "pg_catalog"."default",
"website" varchar(256) COLLATE "pg_catalog"."default",
"package_id" int8 NOT NULL,
"expire_time" timestamp(6) NOT NULL,
"account_count" int4 NOT NULL,
@ -6803,7 +6803,7 @@ ON COLUMN "system_tenant"."contact_mobile" IS '联系手机';
COMMENT
ON COLUMN "system_tenant"."status" IS '租户状态0正常 1停用';
COMMENT
ON COLUMN "system_tenant"."domain" IS '绑定域名';
ON COLUMN "system_tenant"."website" IS '绑定域名';
COMMENT
ON COLUMN "system_tenant"."package_id" IS '租户套餐编号';
COMMENT
@ -6827,17 +6827,17 @@ ON TABLE "system_tenant" IS '租户表';
-- Records of system_tenant
-- ----------------------------
BEGIN;
INSERT INTO "system_tenant" ("id", "name", "contact_user_id", "contact_name", "contact_mobile", "status", "domain",
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, 'https://www.iocoder.cn', 0, '2099-02-19 17:14:16', 9999, '1',
'2021-01-05 17:03:47', '1', '2022-02-23 12:15:11', 0);
INSERT INTO "system_tenant" ("id", "name", "contact_user_id", "contact_name", "contact_mobile", "status", "domain",
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, 'http://www.iocoder.cn', 111, '2024-03-11 00:00:00', 20, '1',
'2022-02-22 00:56:14', '1', '2022-03-19 18:37:20', 0);
INSERT INTO "system_tenant" ("id", "name", "contact_user_id", "contact_name", "contact_mobile", "status", "domain",
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, 'https://www.iocoder.cn', 111, '2022-04-30 00:00:00', 50, '1',

View File

@ -10595,7 +10595,7 @@ CREATE TABLE [dbo].[system_tenant] (
[contact_name] nvarchar(30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[contact_mobile] nvarchar(500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[status] tinyint NOT NULL,
[domain] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[website] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[package_id] bigint NOT NULL,
[expire_time] datetime2(7) NOT NULL,
[account_count] int NOT NULL,
@ -10656,7 +10656,7 @@ EXEC sp_addextendedproperty
'MS_Description', N'绑定域名',
'SCHEMA', N'dbo',
'TABLE', N'system_tenant',
'COLUMN', N'domain'
'COLUMN', N'website'
GO
EXEC sp_addextendedproperty
@ -10731,13 +10731,13 @@ GO
SET IDENTITY_INSERT [dbo].[system_tenant] ON
GO
INSERT INTO [dbo].[system_tenant] ([id], [name], [contact_user_id], [contact_name], [contact_mobile], [status], [domain], [package_id], [expire_time], [account_count], [creator], [create_time], [updater], [update_time], [deleted]) VALUES (N'1', N'芋道源码', NULL, N'芋艿', N'17321315478', N'0', N'https://www.iocoder.cn', N'0', N'2099-02-19 17:14:16.0000000', N'9999', N'1', N'2021-01-05 17:03:47.0000000', N'1', N'2022-02-23 12:15:11.0000000', N'0')
INSERT INTO [dbo].[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 (N'1', N'芋道源码', NULL, N'芋艿', N'17321315478', N'0', N'https://www.iocoder.cn', N'0', N'2099-02-19 17:14:16.0000000', N'9999', N'1', N'2021-01-05 17:03:47.0000000', N'1', N'2022-02-23 12:15:11.0000000', N'0')
GO
INSERT INTO [dbo].[system_tenant] ([id], [name], [contact_user_id], [contact_name], [contact_mobile], [status], [domain], [package_id], [expire_time], [account_count], [creator], [create_time], [updater], [update_time], [deleted]) VALUES (N'121', N'小租户', N'110', N'小王2', N'15601691300', N'0', N'http://www.iocoder.cn', N'111', N'2024-03-11 00:00:00.0000000', N'20', N'1', N'2022-02-22 00:56:14.0000000', N'1', N'2022-03-19 18:37:20.0000000', N'0')
INSERT INTO [dbo].[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 (N'121', N'小租户', N'110', N'小王2', N'15601691300', N'0', N'http://www.iocoder.cn', N'111', N'2024-03-11 00:00:00.0000000', N'20', N'1', N'2022-02-22 00:56:14.0000000', N'1', N'2022-03-19 18:37:20.0000000', N'0')
GO
INSERT INTO [dbo].[system_tenant] ([id], [name], [contact_user_id], [contact_name], [contact_mobile], [status], [domain], [package_id], [expire_time], [account_count], [creator], [create_time], [updater], [update_time], [deleted]) VALUES (N'122', N'测试租户', N'113', N'芋道', N'15601691300', N'0', N'https://www.iocoder.cn', N'111', N'2022-04-30 00:00:00.0000000', N'50', N'1', N'2022-03-07 21:37:58.0000000', N'1', N'2022-03-07 21:37:58.0000000', N'0')
INSERT INTO [dbo].[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 (N'122', N'测试租户', N'113', N'芋道', N'15601691300', N'0', N'https://www.iocoder.cn', N'111', N'2022-04-30 00:00:00.0000000', N'50', N'1', N'2022-03-07 21:37:58.0000000', N'1', N'2022-03-07 21:37:58.0000000', N'0')
GO
SET IDENTITY_INSERT [dbo].[system_tenant] OFF

View File

@ -49,6 +49,7 @@
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>

View File

@ -104,6 +104,7 @@ public interface ErrorCodeConstants {
ErrorCode TENANT_EXPIRE = new ErrorCode(1_002_015_002, "名字为【{}】的租户已过期");
ErrorCode TENANT_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "系统租户不能进行修改、删除等操作!");
ErrorCode TENANT_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "名字为【{}】的租户已存在");
ErrorCode TENANT_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "域名为【{}】的租户已存在");
// ========== 租户套餐 1-002-016-000 ==========
ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "租户套餐不存在");

View File

@ -37,8 +37,17 @@ public class TenantController {
@Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号")
@Parameter(name = "name", description = "租户名", required = true, example = "1024")
public CommonResult<Long> getTenantIdByName(@RequestParam("name") String name) {
TenantDO tenantDO = tenantService.getTenantByName(name);
return success(tenantDO != null ? tenantDO.getId() : null);
TenantDO tenant = tenantService.getTenantByName(name);
return success(tenant != null ? tenant.getId() : null);
}
@GetMapping("/get-by-website")
@PermitAll
@Operation(summary = "使用域名,获得租户信息", description = "登录界面,根据用户的域名,获得租户信息")
@Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn")
public CommonResult<TenantSimpleRespVO> getTenantByWebsite(@RequestParam("website") String website) {
TenantDO tenant = tenantService.getTenantByWebsite(website);
return success(TenantConvert.INSTANCE.convert03(tenant));
}
@PostMapping("/create")
@ -94,5 +103,4 @@ public class TenantController {
ExcelUtils.write(response, "租户.xls", "数据", TenantExcelVO.class, datas);
}
}

View File

@ -29,7 +29,7 @@ public class TenantBaseVO {
private Integer status;
@Schema(description = "绑定域名", example = "https://www.iocoder.cn")
private String domain;
private String website;
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "租户套餐编号不能为空")

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 租户精简 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class TenantSimpleRespVO extends TenantBaseVO {
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
}

View File

@ -1,10 +1,7 @@
package cn.iocoder.yudao.module.system.convert.tenant;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantRespVO;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserCreateReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import org.mapstruct.Mapper;
@ -28,6 +25,8 @@ public interface TenantConvert {
TenantRespVO convert(TenantDO bean);
TenantSimpleRespVO convert03(TenantDO bean);
List<TenantRespVO> convertList(List<TenantDO> list);
PageResult<TenantRespVO> convertPage(PageResult<TenantDO> page);

View File

@ -59,10 +59,8 @@ public class TenantDO extends BaseDO {
private Integer status;
/**
* 绑定域名
*
* TODO 芋艿目前是预留字段未来会支持根据域名自动查询到对应的租户等等
*/
private String domain;
private String website;
/**
* 租户套餐编号
*

View File

@ -42,6 +42,10 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
return selectOne(TenantDO::getName, name);
}
default TenantDO selectByWebsite(String website) {
return selectOne(TenantDO::getWebsite, website);
}
default Long selectCountByPackageId(Long packageId) {
return selectCount(TenantDO::getPackageId, packageId);
}

View File

@ -78,11 +78,19 @@ public interface TenantService {
/**
* 获得名字对应的租户
*
* @param name 户名
* @param name 户名
* @return 租户
*/
TenantDO getTenantByName(String name);
/**
* 获得域名对应的租户
*
* @param website 域名
* @return 租户
*/
TenantDO getTenantByWebsite(String website);
/**
* 获得使用指定套餐的租户数量
*
@ -128,4 +136,5 @@ public interface TenantService {
* @param id 租户编号
*/
void validTenant(Long id);
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.tenant;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
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.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
@ -99,6 +100,8 @@ public class TenantServiceImpl implements TenantService {
public Long createTenant(TenantCreateReqVO createReqVO) {
// 校验租户名称是否重复
validTenantNameDuplicate(createReqVO.getName(), null);
// 校验租户域名是否重复
validTenantWebsiteDuplicate(createReqVO.getWebsite(), null);
// 校验套餐被禁用
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(createReqVO.getPackageId());
@ -143,6 +146,8 @@ public class TenantServiceImpl implements TenantService {
TenantDO tenant = validateUpdateTenant(updateReqVO.getId());
// 校验租户名称是否重复
validTenantNameDuplicate(updateReqVO.getName(), updateReqVO.getId());
// 校验租户域名是否重复
validTenantWebsiteDuplicate(updateReqVO.getWebsite(), updateReqVO.getId());
// 校验套餐被禁用
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId());
@ -169,6 +174,23 @@ public class TenantServiceImpl implements TenantService {
}
}
private void validTenantWebsiteDuplicate(String website, Long id) {
if (StrUtil.isEmpty(website)) {
return;
}
TenantDO tenant = tenantMapper.selectByWebsite(website);
if (tenant == null) {
return;
}
// 如果 id 为空说明不用比较是否为相同名字的租户
if (id == null) {
throw exception(TENANT_WEBSITE_DUPLICATE, website);
}
if (!tenant.getId().equals(id)) {
throw exception(TENANT_WEBSITE_DUPLICATE, website);
}
}
@Override
@DSTransactional
public void updateTenantRoleMenu(Long tenantId, Set<Long> menuIds) {
@ -234,6 +256,11 @@ public class TenantServiceImpl implements TenantService {
return tenantMapper.selectByName(name);
}
@Override
public TenantDO getTenantByWebsite(String website) {
return tenantMapper.selectByWebsite(website);
}
@Override
public Long getTenantCountByPackageId(Long packageId) {
return tenantMapper.selectCountByPackageId(packageId);

View File

@ -157,7 +157,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactMobile("15601691300");
o.setPackageId(100L);
o.setStatus(randomCommonStatus());
o.setDomain("https://www.iocoder.cn");
o.setWebsite("https://www.iocoder.cn");
o.setUsername("yunai");
o.setPassword("yuanma");
});
@ -185,7 +185,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
TenantUpdateReqVO reqVO = randomPojo(TenantUpdateReqVO.class, o -> {
o.setId(dbTenant.getId()); // 设置更新的 ID
o.setStatus(randomCommonStatus());
o.setDomain(randomString());
o.setWebsite(randomString());
});
// mock 套餐

View File

@ -54,10 +54,13 @@ spring:
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
username: root
password: 123456
# username: sa
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
# username: SYSDBA # DM 连接的示例
# password: SYSDBA # DM 连接的示例
slave: # 模拟从库,可根据自己需要修改
name: ruoyi-vue-pro
lazy: true # 开启懒加载,保证启动速度

View File

@ -175,6 +175,7 @@ yudao:
enable: true
ignore-urls:
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
- /admin-api/system/captcha/get # 获取图片验证码,和租户无关
- /admin-api/system/captcha/check # 校验图片验证码,和租户无关
- /admin-api/infra/file/*/get/** # 获取图片,和租户无关