diff --git a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs index 0decbe3..8f4e69d 100644 --- a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs +++ b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs @@ -204,7 +204,7 @@ namespace ZR.Admin.WebApi.Controllers var genTable = genTableDto.Adapt().ToUpdate(HttpContext); //将前端额外参数转成字符串存入Options中 - genTable.Options = JsonConvert.SerializeObject(genTableDto.Params); + genTable.Options = genTableDto.Params.Adapt(); DbResult result = GenTableService.UseTran(() => { int rows = GenTableService.UpdateGenTable(genTable); diff --git a/ZR.Admin.WebApi/Hubs/MessageHub.cs b/ZR.Admin.WebApi/Hubs/MessageHub.cs index 08d776b..caf1f91 100644 --- a/ZR.Admin.WebApi/Hubs/MessageHub.cs +++ b/ZR.Admin.WebApi/Hubs/MessageHub.cs @@ -38,12 +38,13 @@ namespace ZR.Admin.WebApi.Hubs public override Task OnConnectedAsync() { var name = Context.User.Identity.Name; + var ip = HttpContextExtension.GetClientUserIp(App.HttpContext); LoginUser loginUser = JwtUtil.GetLoginUser(App.HttpContext); var user = clientUsers.Any(u => u.ConnnectionId == Context.ConnectionId); //判断用户是否存在,否则添加集合 if (!user && Context.User.Identity.IsAuthenticated) { - clientUsers.Add(new OnlineUsers(Context.ConnectionId, name, loginUser?.UserId)); + clientUsers.Add(new OnlineUsers(Context.ConnectionId, name, loginUser?.UserId, ip)); Console.WriteLine($"{DateTime.Now}:{name},{Context.ConnectionId}连接服务端success,当前已连接{clientUsers.Count}个"); //Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}"); Clients.All.SendAsync(HubsConstant.MoreNotice, SendNotice()); diff --git a/ZR.Admin.WebApi/Hubs/OnlineUsers.cs b/ZR.Admin.WebApi/Hubs/OnlineUsers.cs index c74882c..8c8f803 100644 --- a/ZR.Admin.WebApi/Hubs/OnlineUsers.cs +++ b/ZR.Admin.WebApi/Hubs/OnlineUsers.cs @@ -16,13 +16,15 @@ namespace ZR.Admin.WebApi.Hubs public long? Userid { get; set; } public string Name { get; set; } public DateTime LoginTime { get; set; } - - public OnlineUsers(string clientid, string name, long? userid) + public string UserIP { get; set; } + + public OnlineUsers(string clientid, string name, long? userid, string? userip) { ConnnectionId = clientid; Name = name; LoginTime = DateTime.Now; Userid = userid; + UserIP = userip; } } } diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt index da572de..bfc1360 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/CurdForm.txt @@ -3,7 +3,6 @@ $set(labelName = "") $set(labelDisabled = "") $set(columnName = column.CsharpFieldFl) $set(value = "item.dictValue") - $if(column.ColumnComment != "") $set(labelName = column.ColumnComment) $else diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/MySqlTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/MySqlTemplate.txt index 8531aaf..3c0d5d4 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/MySqlTemplate.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/MySqlTemplate.txt @@ -2,7 +2,7 @@ -- 菜单 INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time) -VALUES ('${genTable.functionName}', ${parentId}, 999, '${genTable.BusinessName}', '${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName}', 0, 0, 'C', '0', '0', '${replaceDto.PermissionPrefix}:list', '', 'system', sysdate()); +VALUES ('${genTable.functionName}', ${parentId}, 999, '${genTable.BusinessName}', '${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName}', 0, 0, 'C', '0', '0', '${replaceDto.PermissionPrefix}:list', 'icon1', 'system', sysdate()); -- 按钮父菜单id SELECT @menuId := LAST_INSERT_ID(); diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/SqlTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/SqlTemplate.txt index fe01bb2..20e0718 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/SqlTemplate.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/SqlTemplate.txt @@ -2,7 +2,7 @@ -- ${genTable.functionName}菜单 INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time) -VALUES ('${genTable.functionName}', ${parentId}, 999, '${genTable.BusinessName}', '${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName}', 0, 0, 'C', '0', '0', '${replaceDto.PermissionPrefix}:list', '', 'system', GETDATE()); +VALUES ('${genTable.functionName}', ${parentId}, 999, '${genTable.BusinessName}', '${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName}', 0, 0, 'C', '0', '0', '${replaceDto.PermissionPrefix}:list', 'icon1', 'system', GETDATE()); -- 按钮父菜单id declare @menuId int = @@identity diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt index 9c9236a..67de9fc 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt @@ -16,7 +16,7 @@ namespace ${options.ModelsNamespace}.Models { $foreach(item in genTable.Columns) /// - /// 描述 : ${item.ColumnComment} + /// 描述 :${item.ColumnComment} ${item.Remark} /// 空值 :$if(item.IsRequired == "True") false $else true $end /// $if(replaceDto.ShowBtnExport) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt index 927cb2b..a098f0b 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt @@ -56,8 +56,8 @@ $end $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) - .OrderBy("${genTable.SortField} ${genTable.SortType}") +$if(genTable.Options.SortField != "" && genTable.Options.SortField != null) + .OrderBy("${genTable.Options.SortField} ${genTable.Options.SortType}") $end .Where(predicate.ToExpression()) .ToPage(parm); @@ -88,7 +88,7 @@ $end $end var response = _${replaceDto.ModelTypeName}Repository.Queryable().Where(predicate.ToExpression()) - .ToTree(it => it.Children, it => it.${genTable.TreeParentCode}, 0); + .ToTree(it => it.Children, it => it.${genTable.Options.TreeParentCode}, 0); return response; } diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplTreeVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplTreeVue.txt index 3748bb3..72cfae3 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplTreeVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplTreeVue.txt @@ -38,7 +38,7 @@ $end + :default-expand-all="isExpandAll" row-key="${tool.FirstLowerCase(genTable.Options.TreeCode)}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> ${VueViewListContent} @@ -204,8 +204,8 @@ $end delete node.children; } return { - id: node.${tool.FirstLowerCase(genTable.TreeCode)}, - label: node.${tool.FirstLowerCase(genTable.TreeName)}, + id: node.${tool.FirstLowerCase(genTable.Options.TreeCode)}, + label: node.${tool.FirstLowerCase(genTable.Options.TreeName)}, children: node.children, }; }, diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt index f744b87..f4f5d5a 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt @@ -156,8 +156,7 @@ $end $foreach(column in genTable.Columns) $if(column.IsRequired && column.IsIncrement == false) ${column.CsharpFieldFl}: [ - { required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end -$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end } + { required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end } ], $end $end diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt index a973c4f..dc05b23 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt @@ -88,7 +88,7 @@ $end highlight-current-row @selection-change="handleSelectionChange" :default-expand-all="isExpandAll" - row-key="${tool.FirstLowerCase(genTable.TreeCode)}" + row-key="${tool.FirstLowerCase(genTable.Options.TreeCode)}" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" > @@ -278,7 +278,7 @@ $end diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt index 19af23e..4c4f917 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt @@ -124,7 +124,7 @@ $elseif(column.HtmlType == "imageUpload") $elseif(column.HtmlType == "checkbox" || column.HtmlType == "select" || column.HtmlType == "radio") - + $else - + $end $end $end -