侧边栏路由新增isNew属性

This commit is contained in:
不做码农 2023-08-17 18:08:15 +08:00
parent d1108700e0
commit 1ca05495d8
3 changed files with 15 additions and 6 deletions

View File

@ -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;
}
}
}
}
}

View File

@ -48,7 +48,7 @@ namespace ZR.Repository
public int Insert(List<T> t)
{
return Context.Insertable(t).ExecuteCommand();
return InsertRange(t) ? 1 : 0;
}
public int Insert(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true)
{

View File

@ -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<SysMenu> 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;