From 1ca05495d83e841c63fe17c429800b1989f74f12 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: Thu, 17 Aug 2023 18:08:15 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E6=96=B0=E5=A2=9EisNew=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Model/System/Vo/RouterVo.cs | 11 ++++++++++- ZR.Repository/BaseRepository.cs | 4 ++-- ZR.Service/System/SysMenuService.cs | 6 +++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ZR.Model/System/Vo/RouterVo.cs b/ZR.Model/System/Vo/RouterVo.cs index e0756c2..dae4a9c 100644 --- a/ZR.Model/System/Vo/RouterVo.cs +++ b/ZR.Model/System/Vo/RouterVo.cs @@ -38,6 +38,7 @@ namespace ZR.Model.System.Vo public bool NoCache { get; set; } public string TitleKey { get; set; } = string.Empty; public string Link { get; set; } = string.Empty; + public int IsNew { get; set; } public Meta(string title, string icon) { @@ -50,7 +51,7 @@ namespace ZR.Model.System.Vo Icon = icon; Link = path; } - public Meta(string title, string icon, bool noCache, string titleKey, string path) + public Meta(string title, string icon, bool noCache, string titleKey, string path, DateTime addTime) { Title = title; Icon = icon; @@ -60,6 +61,14 @@ namespace ZR.Model.System.Vo { Link = path; } + if (addTime != DateTime.MinValue) + { + TimeSpan ts = DateTime.Now - addTime; + if (ts.Days < 7) + { + IsNew = 1; + } + } } } } diff --git a/ZR.Repository/BaseRepository.cs b/ZR.Repository/BaseRepository.cs index ad82256..4f9dc89 100644 --- a/ZR.Repository/BaseRepository.cs +++ b/ZR.Repository/BaseRepository.cs @@ -48,7 +48,7 @@ namespace ZR.Repository public int Insert(List t) { - return Context.Insertable(t).ExecuteCommand(); + return InsertRange(t) ? 1 : 0; } public int Insert(T parm, Expression> iClumns = null, bool ignoreNull = true) { @@ -65,7 +65,7 @@ namespace ZR.Repository //{ // return Context.Updateable(entity); //} - + /// /// 实体根据主键更新 /// diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index ee7369c..592fa93 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -389,12 +389,12 @@ namespace ZR.Service Name = GetRouteName(menu), Path = GetRoutePath(menu), Component = GetComponent(menu), - Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path) + Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path, menu.Create_time) }; List cMenus = menu.Children; //是目录并且有子菜单 - if (cMenus != null && cMenus.Count > 0 && (UserConstants.TYPE_DIR.Equals(menu.MenuType))) + if (cMenus != null && cMenus.Count > 0 && UserConstants.TYPE_DIR.Equals(menu.MenuType)) { router.AlwaysShow = true; router.Redirect = "noRedirect"; @@ -409,7 +409,7 @@ namespace ZR.Service Path = menu.Path, Component = menu.Component, Name = string.IsNullOrEmpty(menu.Path) ? "" : menu.Path.ToLower(), - Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path) + Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path, menu.Create_time) }; childrenList.Add(children); router.Children = childrenList;