Skip to content

Commit

Permalink
vue.admin : add permission repository&service
Browse files Browse the repository at this point in the history
  • Loading branch information
anjoy8 committed Feb 19, 2019
1 parent f152067 commit a575eed
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 19 deletions.
9 changes: 9 additions & 0 deletions Blog.Core.IRepository/IModulePermissionRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Blog.Core.IRepository
{
using Blog.Core.IRepository.Base;
using Blog.Core.Model.Models;

public partial interface IModulePermissionRepository : IBaseRepository<ModulePermission>//类名
{
}
}
10 changes: 10 additions & 0 deletions Blog.Core.IRepository/IPermissionRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

using Blog.Core.IRepository.Base;
using Blog.Core.Model.Models;

namespace Blog.Core.IRepository
{
public partial interface IPermissionRepository : IBaseRepository<Permission>
{
}
}
9 changes: 9 additions & 0 deletions Blog.Core.IServices/IModulePermissionServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Blog.Core.IServices.BASE;
using Blog.Core.Model.Models;

namespace Blog.Core.IServices
{
public partial interface IModulePermissionServices : IBaseServices<ModulePermission>
{
}
}
8 changes: 8 additions & 0 deletions Blog.Core.IServices/IPermissionServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Blog.Core.IServices.BASE;
using Blog.Core.Model.Models;
namespace Blog.Core.IServices
{
public partial interface IPermissionServices : IBaseServices<Permission>
{
}
}
26 changes: 19 additions & 7 deletions Blog.Core.Model/Models/Permission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Blog.Core.Model.Models
{
/// <summary>
/// 按钮表
/// 路由菜单表
/// </summary>
public class Permission : RootEntity
{
Expand All @@ -18,21 +18,27 @@ public Permission()
//this.RoleModulePermission = new List<RoleModulePermission>();
}

/// <summary>
///获取或设置是否禁用,逻辑上的删除,非物理删除
/// </summary>
[SugarColumn(IsNullable = true)]
public bool? IsDeleted { get; set; }
/// <summary>
/// 菜单执行Action名
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string Code { get; set; }
/// <summary>
/// 菜单名
/// 菜单显示名(如用户页、编辑(按钮)、删除(按钮))
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 是否是按钮
/// </summary>
public bool IsButton { get; set; } = false;

/// <summary>
/// 上一级菜单(0表示上一级无菜单)
/// </summary>
public int Pid { get; set; }


/// <summary>
/// 排序
/// </summary>
Expand Down Expand Up @@ -82,6 +88,12 @@ public Permission()
[SugarColumn(IsNullable = true)]
public DateTime? ModifyTime { get; set; }

/// <summary>
///获取或设置是否禁用,逻辑上的删除,非物理删除
/// </summary>
[SugarColumn(IsNullable = true)]
public bool? IsDeleted { get; set; }

//public virtual ICollection<ModulePermission> ModulePermission { get; set; }
//public virtual ICollection<RoleModulePermission> RoleModulePermission { get; set; }
}
Expand Down
6 changes: 4 additions & 2 deletions Blog.Core.Model/Seed/DBSeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ public static async Task SeedAsync(MyContext myContext)
// 注意!一定要手动先创建要给空的数据库
// 会覆盖,可以设置为true,来备份数据
// 如果生成过了,第二次,就不用再执行一遍了,注释掉该方法即可
myContext.CreateTableByEntity(false, typeof(Advertisement), typeof(BlogArticle), typeof(Guestbook), typeof(Module), typeof(ModulePermission), typeof(OperateLog), typeof(PasswordLib), typeof(Permission), typeof(Role), typeof(RoleModulePermission), typeof(sysUserInfo), typeof(Topic), typeof(TopicDetail), typeof(UserRole));
//myContext.CreateTableByEntity(false, typeof(Advertisement), typeof(BlogArticle), typeof(Guestbook), typeof(Module), typeof(ModulePermission), typeof(OperateLog), typeof(PasswordLib), typeof(Permission), typeof(Role), typeof(RoleModulePermission), typeof(sysUserInfo), typeof(Topic), typeof(TopicDetail), typeof(UserRole));

//myContext.Db.CodeFirst.InitTables(typeof(sysUserInfo)); // 后期单独处理某些表
// 后期单独处理某些表
//myContext.Db.CodeFirst.InitTables(typeof(sysUserInfo));
//myContext.Db.CodeFirst.InitTables(typeof(Permission));


#region Advertisement
Expand Down
15 changes: 15 additions & 0 deletions Blog.Core.Repository/ModulePermissionRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Blog.Core.IRepository;
using Blog.Core.Model.Models;
using Blog.Core.Repository.Base;

namespace Blog.Core.Repository
{
public class ModulePermissionRepository : BaseRepository<ModulePermission>, IModulePermissionRepository
{
}
}
15 changes: 15 additions & 0 deletions Blog.Core.Repository/PermissionRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Blog.Core.IRepository;
using Blog.Core.Model.Models;
using Blog.Core.Repository.Base;

namespace Blog.Core.Repository
{
public class PermissionRepository : BaseRepository<Permission>, IPermissionRepository
{
}
}
22 changes: 22 additions & 0 deletions Blog.Core.Services/ModulePermissionServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Blog.Core.Services.BASE;
using Blog.Core.Model.Models;
using Blog.Core.IRepository;
using Blog.Core.IServices;

namespace Blog.Core.Services
{
/// <summary>
/// ModulePermissionServices
/// </summary>
public class ModulePermissionServices : BaseServices<ModulePermission>, IModulePermissionServices
{

IModulePermissionRepository dal;
public ModulePermissionServices(IModulePermissionRepository dal)
{
this.dal = dal;
base.baseDal = dal;
}

}
}
22 changes: 22 additions & 0 deletions Blog.Core.Services/PermissionServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Blog.Core.Services.BASE;
using Blog.Core.Model.Models;
using Blog.Core.IRepository;
using Blog.Core.IServices;

namespace Blog.Core.Services
{
/// <summary>
/// PermissionServices
/// </summary>
public class PermissionServices : BaseServices<Permission>, IPermissionServices
{

IPermissionRepository dal;
public PermissionServices(IPermissionRepository dal)
{
this.dal = dal;
base.baseDal = dal;
}

}
}
30 changes: 20 additions & 10 deletions Blog.Core/Blog.Core.Model.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a575eed

Please sign in to comment.