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") 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.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 3f1ac66..cbf5690 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()))) @@ -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; } 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,