From 0210ed9b70b2d7769d4af96b2b44388bd71a5e0c Mon Sep 17 00:00:00 2001 From: qraddx Date: Thu, 24 Mar 2022 08:36:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.?= =?UTF-8?q?=20closed=20#3727=20=E6=94=AF=E6=8C=81=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=9F=9F=E5=90=8D=E8=87=AA=E5=8A=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/2pigxx.sql | 3 ++- .../pigx/admin/api/entity/SysTenant.java | 6 ++++++ .../admin/controller/SysTenantController.java | 20 +++++-------------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/db/2pigxx.sql b/db/2pigxx.sql index 2439ee74b..ab36c632d 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -769,6 +769,7 @@ CREATE TABLE `sys_tenant` ( `id` bigint NOT NULL COMMENT '租户id', `name` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, `code` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, + `tenant_domain` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, `start_time` datetime DEFAULT NULL COMMENT '开始时间', `end_time` datetime DEFAULT NULL COMMENT '结束时间', `status` char(1) CHARACTER SET utf8mb4 DEFAULT '0', @@ -784,7 +785,7 @@ CREATE TABLE `sys_tenant` ( -- Records of sys_tenant -- ---------------------------- BEGIN; -INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '2019-05-15 00:00:00', '2029-05-15 00:00:00', '0', '0', ' ', ' ', '2019-05-15 15:44:57', '2022-02-10 05:38:48'); +INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '','2019-05-15 00:00:00', '2029-05-15 00:00:00', '0', '0', ' ', ' ', '2019-05-15 15:44:57', '2022-02-10 05:38:48'); COMMIT; -- ---------------------------- diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysTenant.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysTenant.java index e4a0a2a21..332edd33b 100755 --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysTenant.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysTenant.java @@ -58,6 +58,12 @@ public class SysTenant extends Model { @ApiModelProperty(value = "租户编号") private String code; + /** + * 租户域名 + */ + @ApiModelProperty(value = "租户域名") + private String tenantDomain; + /** * 开始时间 */ diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTenantController.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTenantController.java index b626398c0..0cb15504b 100755 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTenantController.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTenantController.java @@ -61,23 +61,13 @@ public class SysTenantController { } /** - * 通过id查询租户 - * @param id id - * @return R - */ - @GetMapping("/{id}") - public R getById(@PathVariable("id") Long id) { - return R.ok(sysTenantService.getById(id)); - } - - /** - * 通过租户编码查询租户信息 - * @param code 租户Code + * 查询租户信息 + * @param tenant 查询条件 * @return 租户信息 */ - @GetMapping("/code/{code}") - public R getByTenantCode(@PathVariable String code) { - return R.ok(sysTenantService.list(Wrappers.lambdaQuery().eq(SysTenant::getCode, code))); + @GetMapping + public R getByObj(SysTenant tenant) { + return R.ok(sysTenantService.list(Wrappers.query(tenant))); } /** From 2b970b0df20753ccd5e4d3b12c09245ecd5cff05 Mon Sep 17 00:00:00 2001 From: qraddx Date: Thu, 24 Mar 2022 12:45:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.?= =?UTF-8?q?=20close=20#3729=20=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=BE=BE=E6=A2=A6=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/datasource/util/DsJdbcUrlEnum.java | 7 +- pigx-visual/pigx-codegen/pom.xml | 7 +- .../codegen/mapper/GeneratorDmMapper.java | 31 ++++++++ .../service/impl/GenFormConfServiceImpl.java | 2 +- .../pig4cloud/pigx/codegen/util/GenUtils.java | 2 +- .../resources/mapper/GeneratorDmMapper.xml | 70 +++++++++++++++++++ .../admin/core/conf/XxlJobAdminConfig.java | 3 +- 7 files changed, 117 insertions(+), 5 deletions(-) create mode 100755 pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDmMapper.java create mode 100755 pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml diff --git a/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java b/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java index eed30ee29..b6b677e21 100644 --- a/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java +++ b/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java @@ -42,7 +42,12 @@ public enum DsJdbcUrlEnum { /** * db2 */ - DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"); + DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"), + + /** + * 达梦 + */ + DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接"); private final String dbName; diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml index 53233a553..431046404 100755 --- a/pigx-visual/pigx-codegen/pom.xml +++ b/pigx-visual/pigx-codegen/pom.xml @@ -15,7 +15,7 @@ 代码生成模块 - 0.0.1 + 0.0.2 11.5.0.0 1.10 @@ -71,6 +71,11 @@ jcc ${db2.version} + + + com.dameng + DmJdbcDriver18 + com.alibaba diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDmMapper.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDmMapper.java new file mode 100755 index 000000000..518d9fb32 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDmMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.codegen.mapper; + +import org.apache.ibatis.annotations.Mapper; + +/** + * 支持 达梦 代码生成器 + * + * @author lengleng + * @date 2022-03-24 + */ +@Mapper +public interface GeneratorDmMapper extends GeneratorMapper { + +} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java index f2b545779..198f333cc 100755 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java @@ -70,7 +70,7 @@ public class GenFormConfServiceImpl extends ServiceImpl columns = mapper.selectTableColumn(tableName, dsName); // 设置velocity资源加载器 Properties prop = new Properties(); - prop.put("file.resource.loader.class", ClasspathResourceLoader.class.getName()); + prop.put("resource.loader.file.class", ClasspathResourceLoader.class.getName()); Velocity.init(prop); Template template = Velocity.getTemplate("template/avue/crud.js.vm", CharsetUtil.UTF_8); VelocityContext context = new VelocityContext(); diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java index 9daff609b..804bcbddc 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java @@ -265,7 +265,7 @@ public class GenUtils { TableEntity tableEntity, Map map) throws IOException { // 设置velocity资源加载器 Properties prop = new Properties(); - prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + prop.put("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(prop); VelocityContext context = new VelocityContext(map); // 函数库 diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml new file mode 100755 index 000000000..a00343d3b --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + SELECT + 'oracle' AS "dbType", + TEMP.COLUMN_NAME AS "columnName", + TEMP.data_type AS "columnType", + TEMP.data_type AS "dataType", + TEMP.comments AS "comments", + CASE + TEMP.constraint_type + WHEN 'P' THEN + 'PRI' + WHEN 'C' THEN + 'UNI' ELSE'' + END "COLUMNKEY" + FROM + ( + SELECT + col.column_id, + col.COLUMN_NAME, + col.data_type, + colc.comments, + uc.constraint_type, + ROW_NUMBER ( ) OVER ( + PARTITION BY col.COLUMN_NAME + ORDER BY + uc.constraint_type DESC + ) AS row_flg + FROM + user_tab_columns col + LEFT JOIN user_col_comments colc ON colc.TABLE_NAME = col.TABLE_NAME + AND colc.COLUMN_NAME = col. + COLUMN_NAME LEFT JOIN user_cons_columns ucc ON ucc.TABLE_NAME = col.TABLE_NAME + AND ucc.COLUMN_NAME = col. + COLUMN_NAME LEFT JOIN user_constraints uc ON uc.CONSTRAINT_NAME = ucc.CONSTRAINT_NAME + WHERE + col.TABLE_NAME = #{tableName} + ) TEMP + WHERE + TEMP.row_flg = 1 + ORDER BY + TEMP.column_id + + + + + + + diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java index db3190794..49c69ea73 100755 --- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java +++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java @@ -37,7 +37,7 @@ public class XxlJobAdminConfig implements InitializingBean, DisposableBean { adminConfig = this; xxlJobScheduler = new XxlJobScheduler(); -// xxlJobScheduler.init(); + // xxlJobScheduler.init(); } @Override @@ -163,4 +163,5 @@ public class XxlJobAdminConfig implements InitializingBean, DisposableBean { public XxlJobScheduler getXxlJobScheduler() { return xxlJobScheduler; } + }