feat:添加个人中心

This commit is contained in:
橙子
2023-03-19 00:42:18 +08:00
parent c613b185da
commit 10fef4e2d9
62 changed files with 1430 additions and 129 deletions

View File

@@ -9,7 +9,7 @@ namespace Yi.Framework.Data.DataSeeds
{
public abstract class AbstractDataSeed<TEntity> : IDataSeed<TEntity>
{
private readonly IRepository<TEntity> _repository;
protected readonly IRepository<TEntity> _repository;
public AbstractDataSeed(IRepository<TEntity> repository)
{
_repository = repository;

View File

@@ -0,0 +1,255 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.DataSeeds;
using Yi.Framework.Ddd.Repositories;
using Yi.RBAC.Domain.Identity.Entities;
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
namespace Yi.BBS.Domain.DataSeed
{
[AppService(typeof(IDataSeed))]
public class BbsMenuDataSeed : AbstractDataSeed<MenuEntity>
{
public BbsMenuDataSeed(IRepository<MenuEntity> repository) : base(repository)
{
}
public override async Task<bool> IsInvoker()
{
return !await _repository.IsAnyAsync(x => x.MenuName == "BBS");
}
public override List<MenuEntity> GetSeedData()
{
List<MenuEntity> entities = new List<MenuEntity>();
//BBS
MenuEntity bbs = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "BBS",
MenuType = MenuTypeEnum.Catalogue,
Router = "/bbs",
IsShow = true,
IsLink = false,
MenuIcon = "international",
OrderNum = 97,
ParentId = 0,
IsDeleted = false
};
entities.Add(bbs);
//文章管理
MenuEntity article = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章管理",
PermissionCode = "bbs:article:list",
MenuType = MenuTypeEnum.Menu,
Router = "article",
IsShow = true,
IsLink = false,
IsCache = true,
Component = "bbs/article/index",
MenuIcon = "education",
OrderNum = 100,
ParentId = bbs.Id,
IsDeleted = false
};
entities.Add(article);
MenuEntity articleQuery = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章查询",
PermissionCode = "bbs:article:query",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleQuery);
MenuEntity articleAdd = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章新增",
PermissionCode = "bbs:article:add",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleAdd);
MenuEntity articleEdit = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章修改",
PermissionCode = "bbs:article:edit",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleEdit);
MenuEntity articleRemove = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章删除",
PermissionCode = "bbs:article:remove",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleRemove);
//主题管理
MenuEntity discuss = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "主题管理",
PermissionCode = "bbs:discuss:list",
MenuType = MenuTypeEnum.Menu,
Router = "discuss",
IsShow = true,
IsLink = false,
IsCache = true,
Component = "bbs/discuss/index",
MenuIcon = "education",
OrderNum = 100,
ParentId = bbs.Id,
IsDeleted = false
};
entities.Add(discuss);
MenuEntity discussQuery = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "主题查询",
PermissionCode = "bbs:discuss:query",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = discuss.Id,
IsDeleted = false
};
entities.Add(discussQuery);
MenuEntity discussAdd = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "主题新增",
PermissionCode = "bbs:discuss:add",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = discuss.Id,
IsDeleted = false
};
entities.Add(discussAdd);
MenuEntity discussEdit = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "主题修改",
PermissionCode = "bbs:discuss:edit",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = discuss.Id,
IsDeleted = false
};
entities.Add(discussEdit);
MenuEntity discussRemove = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "主题删除",
PermissionCode = "bbs:discuss:remove",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = discuss.Id,
IsDeleted = false
};
entities.Add(discussRemove);
//板块管理
MenuEntity plate = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "板块管理",
PermissionCode = "bbs:plate:list",
MenuType = MenuTypeEnum.Menu,
Router = "plate",
IsShow = true,
IsLink = false,
IsCache = true,
Component = "bbs/plate/index",
MenuIcon = "education",
OrderNum = 100,
ParentId = bbs.Id,
IsDeleted = false
};
entities.Add(plate);
MenuEntity plateQuery = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "板块查询",
PermissionCode = "bbs:plate:query",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = plate.Id,
IsDeleted = false
};
entities.Add(plateQuery);
MenuEntity plateAdd = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "板块新增",
PermissionCode = "bbs:plate:add",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = plate.Id,
IsDeleted = false
};
entities.Add(plateAdd);
MenuEntity plateEdit = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "板块修改",
PermissionCode = "bbs:plate:edit",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = plate.Id,
IsDeleted = false
};
entities.Add(plateEdit);
MenuEntity plateRemove = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "板块删除",
PermissionCode = "bbs:plate:remove",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = plate.Id,
IsDeleted = false
};
entities.Add(plateRemove);
//默认值
entities.ForEach(m =>
{
m.IsDeleted = false;
m.State = true;
});
return entities;
}
}
}

View File

@@ -12,6 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain.Shared\Yi.BBS.Domain.Shared.csproj" />
</ItemGroup>

View File

@@ -22,12 +22,18 @@
</ItemGroup>
<ItemGroup>
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="yi-sqlsugar-dev.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -12,6 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain.Shared\Yi.BBS.Domain.Shared.csproj" />
</ItemGroup>

View File

@@ -22,12 +22,18 @@
</ItemGroup>
<ItemGroup>
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="yi-sqlsugar-dev.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -24,6 +24,7 @@ namespace Yi.RBAC.Application.Identity
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.MenuName), x => x.MenuName.Contains(input.MenuName!))
.WhereIF(input.State is not null, x => x.State == input.State)
.OrderByDescending(x=>x.OrderNum)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<MenuGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}

View File

@@ -17,6 +17,10 @@ namespace Yi.RBAC.Domain.DataSeeds
{
}
public override async Task<bool> IsInvoker()
{
return !await _repository.IsAnyAsync(x => x.MenuName == "系统管理");
}
public override List<MenuEntity> GetSeedData()
{
List<MenuEntity> entities = new List<MenuEntity>();
@@ -107,88 +111,6 @@ namespace Yi.RBAC.Domain.DataSeeds
entities.Add(swagger);
//BBS
MenuEntity bbs = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "BBS",
MenuType = MenuTypeEnum.Catalogue,
Router = "/bbs",
IsShow = true,
IsLink = false,
MenuIcon = "international",
OrderNum = 97,
ParentId = 0,
IsDeleted = false
};
entities.Add(bbs);
//文章管理
MenuEntity article = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章管理",
PermissionCode = "bbs:article:list",
MenuType = MenuTypeEnum.Menu,
Router = "article",
IsShow = true,
IsLink = false,
IsCache = true,
Component = "bbs/article/index",
MenuIcon = "education",
OrderNum = 100,
ParentId = bbs.Id,
IsDeleted = false
};
entities.Add(article);
MenuEntity articleQuery = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章查询",
PermissionCode = "bbs:article:query",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleQuery);
MenuEntity articleAdd = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章新增",
PermissionCode = "bbs:article:add",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleAdd);
MenuEntity articleEdit = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章修改",
PermissionCode = "bbs:article:edit",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleEdit);
MenuEntity articleRemove = new MenuEntity()
{
Id = SnowflakeHelper.NextId,
MenuName = "文章删除",
PermissionCode = "bbs:article:remove",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = article.Id,
IsDeleted = false
};
entities.Add(articleRemove);
//ERP
MenuEntity erp = new MenuEntity()
{
@@ -1143,6 +1065,13 @@ namespace Yi.RBAC.Domain.DataSeeds
IsDeleted = false
};
entities.Add(loginLogRemove);
//默认值
entities.ForEach(m =>
{
m.IsDeleted = false;
m.State = true;
});
return entities;
}
}