Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp
# Conflicts: # .gitignore # Yi.Abp.Net8/src/Yi.Abp.Web/Logs/log-20231214.txt
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
public string Content { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
public List<Guid> PermissionUserIds { get; set; }
|
||||
public List<Guid>? PermissionUserIds { get; set; }
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Yi.Framework.Bbs.Application.Services
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取文章全部平铺信息
|
||||
/// 获取文章全部树级信息
|
||||
/// </summary>
|
||||
/// <param name="discussId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
|
||||
{
|
||||
public class BbsDictionaryDataSeed : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private ISqlSugarRepository<DictionaryEntity> _repository;
|
||||
private ISqlSugarRepository<DictionaryTypeEntity> _typeRepository;
|
||||
public BbsDictionaryDataSeed(ISqlSugarRepository<DictionaryEntity> repository, ISqlSugarRepository<DictionaryTypeEntity> typeRepository) {
|
||||
_repository=repository;
|
||||
_typeRepository=typeRepository;
|
||||
|
||||
}
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
if (!await _typeRepository.IsAnyAsync(x => x.DictType== "bbs_type_lable"))
|
||||
{
|
||||
await _typeRepository.InsertManyAsync(GetSeedDictionaryTypeData());
|
||||
await _repository.InsertManyAsync(GetSeedDictionaryData());
|
||||
}
|
||||
}
|
||||
public List<DictionaryEntity> GetSeedDictionaryData()
|
||||
{
|
||||
List<DictionaryEntity> entities = new List<DictionaryEntity>();
|
||||
DictionaryEntity dictInfo1 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "前端",
|
||||
DictValue = "0",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 100,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
|
||||
};
|
||||
entities.Add(dictInfo1);
|
||||
|
||||
DictionaryEntity dictInfo2 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "后端",
|
||||
DictValue = "1",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 99,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo2);
|
||||
|
||||
DictionaryEntity dictInfo3 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "运维",
|
||||
DictValue = "2",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 98,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo3);
|
||||
DictionaryEntity dictInfo4 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "测试",
|
||||
DictValue = "3",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 97,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo4);
|
||||
|
||||
DictionaryEntity dictInfo5 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "UI",
|
||||
DictValue = "4",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 96,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo5);
|
||||
|
||||
|
||||
DictionaryEntity dictInfo6 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "产品",
|
||||
DictValue = "5",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 95,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo6);
|
||||
|
||||
DictionaryEntity dictInfo7 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "项目",
|
||||
DictValue = "6",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 94,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo7);
|
||||
|
||||
DictionaryEntity dictInfo8 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "C#",
|
||||
DictValue = "7",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 93,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo8);
|
||||
|
||||
DictionaryEntity dictInfo9 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = ".Net",
|
||||
DictValue = "8",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 92,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo9);
|
||||
|
||||
|
||||
DictionaryEntity dictInfo10 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = ".NetCore",
|
||||
DictValue = "9",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 91,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo10);
|
||||
|
||||
|
||||
DictionaryEntity dictInfo11 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "Asp.NetCore",
|
||||
DictValue = "10",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 90,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo11);
|
||||
|
||||
DictionaryEntity dictInfo12 = new DictionaryEntity()
|
||||
{
|
||||
|
||||
DictLabel = "Abp.vNext",
|
||||
DictValue = "11",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 89,
|
||||
Remark = "",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dictInfo12);
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
public List<DictionaryTypeEntity> GetSeedDictionaryTypeData()
|
||||
{
|
||||
List<DictionaryTypeEntity> entities = new List<DictionaryTypeEntity>();
|
||||
DictionaryTypeEntity dict1 = new DictionaryTypeEntity()
|
||||
{
|
||||
|
||||
DictName = "BBS类型标签",
|
||||
DictType = "bbs_type_lable",
|
||||
OrderNum = 200,
|
||||
Remark = "BBS类型标签",
|
||||
IsDeleted = false,
|
||||
State = true
|
||||
};
|
||||
entities.Add(dict1);
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar.DistributedSystem.Snowflake;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Guids;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
|
||||
{
|
||||
public class BbsMenuDataSeed : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private IGuidGenerator _guidGenerator;
|
||||
private ISqlSugarRepository<MenuEntity, Guid> _repository;
|
||||
public BbsMenuDataSeed(ISqlSugarRepository<MenuEntity,Guid> repository, IGuidGenerator guidGenerator)
|
||||
{
|
||||
_repository=repository;
|
||||
_guidGenerator=guidGenerator;
|
||||
}
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
if (!await _repository.IsAnyAsync(x => x.MenuName == "BBS"))
|
||||
{
|
||||
await _repository.InsertManyAsync(GetSeedData());
|
||||
}
|
||||
}
|
||||
|
||||
public List<MenuEntity> GetSeedData()
|
||||
{
|
||||
List<MenuEntity> entities = new List<MenuEntity>();
|
||||
//BBS
|
||||
MenuEntity bbs = new MenuEntity(_guidGenerator.Create())
|
||||
{
|
||||
MenuName = "BBS",
|
||||
MenuType = MenuTypeEnum.Catalogue,
|
||||
Router = "/bbs",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
MenuIcon = "monitor",
|
||||
OrderNum = 91,
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(bbs);
|
||||
|
||||
|
||||
|
||||
//板块管理
|
||||
MenuEntity plate = new MenuEntity(_guidGenerator.Create())
|
||||
{
|
||||
|
||||
MenuName = "板块管理",
|
||||
PermissionCode = "bbs:plate:list",
|
||||
MenuType = MenuTypeEnum.Menu,
|
||||
Router = "plate",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
IsCache = true,
|
||||
Component = "bbs/plate/index",
|
||||
MenuIcon = "component",
|
||||
OrderNum = 100,
|
||||
ParentId = bbs.Id,
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(plate);
|
||||
|
||||
//文章管理
|
||||
MenuEntity article = new MenuEntity(_guidGenerator.Create())
|
||||
{
|
||||
|
||||
MenuName = "文章管理",
|
||||
PermissionCode = "bbs:article:list",
|
||||
MenuType = MenuTypeEnum.Menu,
|
||||
Router = "article",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
IsCache = true,
|
||||
Component = "bbs/article/index",
|
||||
MenuIcon = "documentation",
|
||||
OrderNum = 99,
|
||||
ParentId = bbs.Id,
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(article);
|
||||
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Yi.Framework.Bbs.SqlSugarCore.Repositories
|
||||
|
||||
public async Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where)
|
||||
{
|
||||
return await _DbQueryable.Where(where).ToTreeAsync(x => x.Children, x => x.ParentId, 0);
|
||||
return await _DbQueryable.Where(where).ToTreeAsync(x => x.Children, x => x.ParentId, Guid.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user