From d6cd248e10c1f53f57b94d725218b75293e84c76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 9 May 2022 18:03:33 +0800
Subject: [PATCH 1/4] =?UTF-8?q?fix=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt | 2 +-
ZR.CodeGenerator/CodeGeneratorTool.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index acf31de..b2f9efc 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -9,7 +9,7 @@ using ${options.ModelsNamespace}.Models;
using ${options.IServicsNamespace}.${options.SubNamespace}.I${options.SubNamespace}Service;
using ${options.ApiControllerNamespace}.Extensions;
using ${options.ApiControllerNamespace}.Filters;
-using ${options.BaseNamespace}.Common;
+using ${options.BaseNamespace}Common;
namespace ${options.ApiControllerNamespace}.Controllers
{
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 3f1ac66..23d6b76 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -460,7 +460,7 @@ namespace ZR.CodeGenerator
IsInsert = !column.IsIdentity || GenConstants.inputDtoNoField.Any(f => f.Contains(column.DbColumnName, StringComparison.OrdinalIgnoreCase)),//非自增字段都需要插入
IsEdit = true,
IsQuery = false,
- HtmlType = GenConstants.HTML_INPUT
+ HtmlType = GenConstants.HTML_INPUT,
};
if (GenConstants.imageFiled.Any(f => column.DbColumnName.ToLower().Contains(f.ToLower())))
From 387d69a8f2a3ee93d4332e9ebee8bbaede76e7cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 9 May 2022 18:55:03 +0800
Subject: [PATCH 2/4] =?UTF-8?q?fix=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt | 2 +-
ZR.CodeGenerator/CodeGeneratorTool.cs | 2 +-
ZR.Service/System/GenTableService.cs | 5 ++++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt
index 219b23b..927cb2b 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt
@@ -53,7 +53,7 @@ $end
$end
var response = _${replaceDto.ModelTypeName}Repository
.Queryable()
-$if(genTable.SubTableName != "" && genTable.SubTableName != null)
+$if(null != genTable.SubTableName && "" != genTable.SubTableName)
.Includes(it => it.Sub.MappingField(z => z.${genTable.SubTableFkName}, () => it.${replaceDto.PKName}))
$end
$if(genTable.SortField != "" && genTable.SortField != null)
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 23d6b76..cbf5690 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -513,7 +513,7 @@ namespace ZR.CodeGenerator
///
private static void InitJntTemplate(GenerateDto dto, ReplaceDto replaceDto)
{
- //Engine.Current.Clean();
+ Engine.Current.Clean();
dto.GenTable.Columns = dto.GenTable.Columns.OrderBy(x => x.Sort).ToList();
bool showCustomInput = dto.GenTable.Columns.Any(f => f.HtmlType.Equals(GenConstants.HTML_CUSTOM_INPUT, StringComparison.OrdinalIgnoreCase));
//jnt模板引擎全局变量
diff --git a/ZR.Service/System/GenTableService.cs b/ZR.Service/System/GenTableService.cs
index a9fbe81..b6d2051 100644
--- a/ZR.Service/System/GenTableService.cs
+++ b/ZR.Service/System/GenTableService.cs
@@ -60,7 +60,10 @@ namespace ZR.Service.System
if (info != null && !info.SubTableName.IsEmpty())
{
info.SubTable = GenTableRepository.Queryable().Where(f => f.SubTableName == info.TableName).First();
- SetTableFromOptions(info?.SubTable);
+ if (info?.SubTable != null)
+ {
+ SetTableFromOptions(info?.SubTable);
+ }
}
return info;
}
From 17cf2ac22fd037a0487c2377464542233449b7f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 9 May 2022 18:56:48 +0800
Subject: [PATCH 3/4] update admin-sqlserver.sql
---
document/admin-sqlserver.sql | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index 6508b95..038eba1 100644
--- a/document/admin-sqlserver.sql
+++ b/document/admin-sqlserver.sql
@@ -242,7 +242,7 @@ INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFr
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', 0, 0, 'C', '0', '0', 'system:dept:list', 'tree', '', GETDATE(), 'menu.systemDept');
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', 0, 0, 'C', '0', '0', 'system:post:list', 'post', '', GETDATE(), 'menu.systemPost');
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', GETDATE(), 'menu.systemDic');
-INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (106, '角色分配', 1, 2, 'roleusers','system/roleusers/index', 0, 0, 'C', '1', '0', 'system:roleusers:list', 'people', '', GETDATE());
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (106, '角色分配', 1, 2, 'roleusers','system/roleusers/index', 0, 0, 'C', '1', '0', 'system:roleusers:list', 'people', '', GETDATE(), '');
INSERT into sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (107, '参数设置', 1, 8, 'config', 'system/config/index', 0, 0, 'C', '0', '0', 'system:config:list','edit','', GETDATE(), 'menu.systemParam');
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (108, '日志管理', 1, 10, 'log', '', 0, 0, 'M', '0', '0', '', 'log', '', GETDATE(), 'menu.systemLog');
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, menuName_key) VALUES (109, '通知公告', 1, 9, 'notice', 'system/notice/index', 0, 0, 'C', '0', '0', 'system:notice:list', 'message', '', GETDATE(), 'menu.systemNotice');
@@ -339,10 +339,35 @@ INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFr
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, update_by, update_time, remark) VALUES (1064, '生成代码', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:gen:code', '', '', GETDATE(), '', NULL, NULL);
INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time, update_by, update_time, remark) VALUES (1065, '预览代码', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:gen:preview', '', '', GETDATE(), '', NULL, NULL);
+SET IDENTITY_INSERT sys_menu OFF
+
+GO
+-- 文件存储菜单
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time, remark, menuName_key)
+VALUES ('文件存储', 3, 17, 'file', 'tool/file/index', 0, 0, 'C', '0', '0', 'tool:file:list', 'upload', '', '', '文件存储菜单', 'menu.fileStorage');
+
+-- 按钮父菜单id
+DECLARE @fileMenuId INT = SCOPE_IDENTITY();
+
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
+VALUES ('查询', @fileMenuId, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:query', '', '');
+
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
+VALUES ('新增', @fileMenuId, 2, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:add', '', '');
+
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
+VALUES ('删除', @fileMenuId, 3, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:delete', '', '');
+
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
+VALUES ('修改', @fileMenuId, 4, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:update', '', '');
+
+INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
+VALUES ('导出', @fileMenuId, 5, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:export', '', '');
+GO
-- 多语言配置菜单
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time, menuName_key)
-VALUES ('多语言配置', 1, 999, 'CommonLang', 'system/commonLang/index', 0, 0, 'C', '0', '0', 'system:lang:list', '', 'system', GETDATE(), 'menu.systemLang');
+VALUES ('多语言配置', 1, 999, 'CommonLang', 'system/commonLang/index', 0, 0, 'C', '0', '0', 'system:lang:list', 'language', 'system', GETDATE(), 'menu.systemLang');
-- 按钮父菜单id
DECLARE @menuId INT = @@identity
@@ -362,10 +387,7 @@ VALUES ('修改', @menuId, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:lang:edit'
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
VALUES ('导出', @menuId, 5, '#', NULL, 0, 0, 'F', '0', '0', 'system:lang:export', '', 'system', GETDATE());
-
-SET IDENTITY_INSERT sys_menu OFF
GO
-
-- ----------------------------
-- = '操作日志记录'
-- Table structure for sys_oper_log
@@ -782,6 +804,8 @@ CREATE TABLE [dbo].[sys_file](
[storeType] [INT] NULL
)
GO
+IF OBJECT_ID(N'sys_common_lang',N'U') is not NULL DROP TABLE sys_common_lang
+GO
CREATE TABLE sys_common_lang
(
id BIGINT NOT NULL,
From f6ded6ce36a5679f29a5e78ee3fff929a56cf9e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 9 May 2022 20:19:47 +0800
Subject: [PATCH 4/4] update CurdForm.txt
---
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt
index 2c37aa2..da572de 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt
@@ -53,13 +53,13 @@ $elseif(column.HtmlType == "datetime")
$elseif(column.HtmlType == "imageUpload")
-
+
$elseif(column.HtmlType == "fileUpload")
-
+
$elseif(column.HtmlType == "radio")