2 Commits

Author SHA1 Message Date
CoderKK
f094ae5e83 Pre Merge pull request !91 from CoderKK/removePrefixTableName 2025-08-26 02:06:38 +00:00
CoderKK
374cc92a79 fix(code-generator): 修复表前缀去除功能
- 在去除表前缀时,使用 slice 方法替代 trimStart 和 trim 方法
- 修复了之前使用 _.trimStart 或 _.trim 导致的命名错误问题
2025-08-26 10:05:18 +08:00
15 changed files with 98 additions and 46 deletions

View File

@@ -4,7 +4,7 @@
**<font color="#DC143C">国内首个满足《网络安全-三级等保》、《数据安全》</font>** 功能要求,支持登录限制、接口国产加解密、数据脱敏等一系列安全要求。
**<font color="#DC143C">支持国产数据库:【达梦、金仓、南大通用、海量数据、神州通用、OceanBase、GaussDB 高斯、阿里PolarDB、GoldenDB】等主流数据库【MysqlPostgreSQL、SqlServer】等</font>**
**<font color="#DC143C">支持国产数据库【达梦、金仓、南大通用、OceanBase、GaussDB 高斯、阿里PolarDB、GoldenDB】等主流数据库【Mysql, PostgreSQL】等</font>**
**<font color="#DC143C">前端提供JavaScript和TypeScript双版本后端提供Java8+SpringBoot2.X和Java17+SpringBoot3.X 双版本</font>**。

View File

@@ -18,16 +18,13 @@ JavaTypeMap.set('double', 'BigDecimal');
JavaTypeMap.set('decimal', 'BigDecimal');
JavaTypeMap.set('char', 'String');
JavaTypeMap.set('varchar', 'String');
JavaTypeMap.set('nvarchar', 'String');
JavaTypeMap.set('tinytext', 'String');
JavaTypeMap.set('text', 'String');
JavaTypeMap.set('longtext', 'String');
JavaTypeMap.set('blob', 'String');
JavaTypeMap.set('date', 'LocalDate');
JavaTypeMap.set('datetime', 'LocalDateTime');
JavaTypeMap.set('datetime2', 'LocalDateTime');
JavaTypeMap.set('timestamp', 'LocalDateTime');
JavaTypeMap.set('timestamp without time zone', 'LocalDateTime');
export const JavaTypeList = [
'Boolean', //
@@ -62,7 +59,6 @@ JsTypeMap.set('double', 'Number');
JsTypeMap.set('decimal', 'Number');
JsTypeMap.set('char', 'String');
JsTypeMap.set('varchar', 'String');
JsTypeMap.set('nvarchar', 'String');
JsTypeMap.set('character', 'String');
JsTypeMap.set('tinytext', 'String');
JsTypeMap.set('text', 'String');
@@ -70,9 +66,7 @@ JsTypeMap.set('longtext', 'String');
JsTypeMap.set('blob', 'String');
JsTypeMap.set('date', 'Date');
JsTypeMap.set('datetime', 'Date');
JsTypeMap.set('datetime2', 'Date');
JsTypeMap.set('timestamp', 'Date');
JsTypeMap.set('timestamp without time zone', 'Date');
export const JsTypeList = [
'Boolean', //
@@ -105,7 +99,6 @@ FrontComponentMap.set('double', 'InputNumber');
FrontComponentMap.set('decimal', 'InputNumber');
FrontComponentMap.set('char', 'Input');
FrontComponentMap.set('varchar', 'Input');
FrontComponentMap.set('nvarchar', 'Input');
FrontComponentMap.set('character', 'Input');
FrontComponentMap.set('tinytext', 'Input');
FrontComponentMap.set('text', 'Textarea');
@@ -113,8 +106,6 @@ FrontComponentMap.set('longtext', 'Textarea');
FrontComponentMap.set('blob', 'FileUpload');
FrontComponentMap.set('date', 'Date');
FrontComponentMap.set('datetime', 'DateTime');
FrontComponentMap.set('datetime2', 'DateTime');
FrontComponentMap.set('timestamp without time zone', 'DateTime');
export function getFrontComponent(dataType) {
return FrontComponentMap.get(dataType);

View File

@@ -182,7 +182,7 @@
//命名
let removePrefixTableName = tableInfo.tableName;
if (_.startsWith(tableInfo.tableName, tablePrefix.value)) {
removePrefixTableName = _.trimStart(removePrefixTableName, tablePrefix.value);
removePrefixTableName = removePrefixTableName.slice(tablePrefix.value.length);
}
formData.moduleName = basic && basic.moduleName ? basic.moduleName : removePrefixTableName;
formData.moduleName = convertUpperCamel(formData.moduleName);
@@ -205,7 +205,7 @@
function onChangeTablePrefix(e) {
let removePrefixTableName = tableInfo.tableName;
if (_.startsWith(tableInfo.tableName, tablePrefix.value)) {
removePrefixTableName = _.trim(removePrefixTableName, tablePrefix.value);
removePrefixTableName = tableInfo.tableName.slice(tablePrefix.value.length);
}
formData.moduleName = convertUpperCamel(removePrefixTableName);
}

View File

@@ -18,16 +18,13 @@ JavaTypeMap.set('double', 'BigDecimal');
JavaTypeMap.set('decimal', 'BigDecimal');
JavaTypeMap.set('char', 'String');
JavaTypeMap.set('varchar', 'String');
JavaTypeMap.set('nvarchar', 'String');
JavaTypeMap.set('tinytext', 'String');
JavaTypeMap.set('text', 'String');
JavaTypeMap.set('longtext', 'String');
JavaTypeMap.set('blob', 'String');
JavaTypeMap.set('date', 'LocalDate');
JavaTypeMap.set('datetime', 'LocalDateTime');
JavaTypeMap.set('datetime2', 'LocalDateTime');
JavaTypeMap.set('timestamp', 'LocalDateTime');
JavaTypeMap.set('timestamp without time zone', 'LocalDateTime');
export const JavaTypeList = [
'Boolean', //
@@ -62,7 +59,6 @@ JsTypeMap.set('double', 'Number');
JsTypeMap.set('decimal', 'Number');
JsTypeMap.set('char', 'String');
JsTypeMap.set('varchar', 'String');
JsTypeMap.set('nvarchar', 'String');
JsTypeMap.set('character', 'String');
JsTypeMap.set('tinytext', 'String');
JsTypeMap.set('text', 'String');
@@ -70,9 +66,7 @@ JsTypeMap.set('longtext', 'String');
JsTypeMap.set('blob', 'String');
JsTypeMap.set('date', 'Date');
JsTypeMap.set('datetime', 'Date');
JsTypeMap.set('datetime2', 'Date');
JsTypeMap.set('timestamp', 'Date');
JsTypeMap.set('timestamp without time zone', 'Date');
export const JsTypeList = [
'Boolean', //
@@ -105,7 +99,6 @@ FrontComponentMap.set('double', 'InputNumber');
FrontComponentMap.set('decimal', 'InputNumber');
FrontComponentMap.set('char', 'Input');
FrontComponentMap.set('varchar', 'Input');
FrontComponentMap.set('nvarchar', 'Input');
FrontComponentMap.set('character', 'Input');
FrontComponentMap.set('tinytext', 'Input');
FrontComponentMap.set('text', 'Textarea');
@@ -113,8 +106,6 @@ FrontComponentMap.set('longtext', 'Textarea');
FrontComponentMap.set('blob', 'FileUpload');
FrontComponentMap.set('date', 'Date');
FrontComponentMap.set('datetime', 'DateTime');
FrontComponentMap.set('datetime2', 'DateTime');
FrontComponentMap.set('timestamp without time zone', 'DateTime');
export function getFrontComponent(dataType) {
return FrontComponentMap.get(dataType);

View File

@@ -182,7 +182,7 @@
//命名
let removePrefixTableName = tableInfo.tableName;
if (_.startsWith(tableInfo.tableName, tablePrefix.value)) {
removePrefixTableName = _.trimStart(removePrefixTableName, tablePrefix.value);
removePrefixTableName = removePrefixTableName.slice(tablePrefix.value.length);
}
formData.moduleName = basic && basic.moduleName ? basic.moduleName : removePrefixTableName;
formData.moduleName = convertUpperCamel(formData.moduleName);
@@ -205,7 +205,7 @@
function onChangeTablePrefix(e) {
let removePrefixTableName = tableInfo.tableName;
if (_.startsWith(tableInfo.tableName, tablePrefix.value)) {
removePrefixTableName = _.trim(removePrefixTableName, tablePrefix.value);
removePrefixTableName = tableInfo.tableName.slice(tablePrefix.value.length);
}
formData.moduleName = convertUpperCamel(removePrefixTableName);
}

View File

@@ -1,16 +1,9 @@
### 数据库脚本
默认数据库为Mysql若为其他数据库请关注[SmartAdmin其他数据库](https://smartadmin.vip/views/other/china-db/)
#### 第一次
如果是第一次部署,只需要执行 smart_admin_v3.sql 文件中的SQL语句即可
序号| 数据库 | 类型 | 支持 | 下载
-------- |-------------------------------------------------------------------|--------------------| ----- | ----
1| [Mysql](https://www.mysql.com) | 国外 | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://gitee.com/lab1024/smart-admin/tree/master/%E6%95%B0%E6%8D%AE%E5%BA%93SQL%E8%84%9A%E6%9C%AC/mysql)
2| [PostgreSQL](https://www.postgresql.org/) | 国外 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
3| [SqlServer](https://www.microsoft.com/en-us/sql-server/) | 国外 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
4| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | 国产 | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
5| [电科(人大)金仓 KingBaseES](https://www.kingbase.com.cn) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
6| [华为高斯 GaussDB](https://www.huaweicloud.com/product/gaussdb.html) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
7| [OpenGaussDB](https://opengauss.org/zh/) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
8| [神通数据库 ShenTong](http://www.shentongdata.com.cn/) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
9| [海量数据库 VastData](https://www.vastdata.com.cn) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
10| [海扬数据库 OceanBase](https://www.oceanbase.com/) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
11| [阿里云 PolarDB](https://www.polardbx.com/) | 国产 | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
#### 更新
跟随 SmartAdmin更新则需要执行 sql-update-log目录中的SQL脚本需要按照文件版本从小到大执行

View File

@@ -1,9 +0,0 @@
### 数据库脚本
默认数据库为Mysql若为其他数据库请关注[SmartAdmin其他数据库](https://smartadmin.vip/views/other/china-db/)
#### 第一次
如果是第一次部署,只需要执行 smart_admin_v3.sql 文件中的SQL语句即可
#### 更新
跟随 SmartAdmin更新则需要执行 sql-update-log目录中的SQL脚本需要按照文件版本从小到大执行

View File

@@ -0,0 +1,9 @@
## 主流
序号| 数据库 | 状态 | 下载
-------- |-------------------------------------------|-------------------| -----
1| [Mysql](https://www.mysql.com) | Java8+Java17 都支持 ✔️ |
2| [PostgreSQL](https://www.postgresql.org/) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)

View File

@@ -0,0 +1,11 @@
## 国产数据库支持
序号| 数据库 | 支持 | 下载
-------- |---------------------------------------------------| ----- | ----
1| [达梦数据库 DM8](https://www.dameng.com/DM8.html) | Java8+Java17 都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)
2| [电科(人大)金仓KingBaseES](https://www.kingbase.com.cn) | Java8+Java17都支持 ✔️ | [下载代码和SQL](https://smartadmin.vip/views/other/china-db/)