SysRoleSeedData.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Furion.DatabaseAccessor;
  2. using Furion.JsonSerialization;
  3. using Microsoft.EntityFrameworkCore;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace YBEE.EQM.Core.SeedData;
  7. /// <summary>
  8. /// 角色种子
  9. /// </summary>
  10. public class SysRoleSeedData : IEntitySeedData<SysRole>
  11. {
  12. /// <summary>
  13. /// 种子数据
  14. /// </summary>
  15. /// <param name="dbContext"></param>
  16. /// <param name="dbContextLocator"></param>
  17. /// <returns></returns>
  18. public IEnumerable<SysRole> HasData(DbContext dbContext, Type dbContextLocator)
  19. {
  20. return new[]
  21. {
  22. new SysRole { Id = 1, Name = "超级管理员", SysRoleGroupId = 1, RoleType = RoleType.SUPER_ADMIN, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  23. new SysRole { Id = 2, Name = "管理员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  24. new SysRole { Id = 3, Name = "小学特殊学生审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages=new(){ EducationStage.PRIMARY_SCHOOL_STAGE } }) },
  25. new SysRole { Id = 4, Name = "小学缺测替补审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages=new(){ EducationStage.PRIMARY_SCHOOL_STAGE } }) },
  26. new SysRole { Id = 5, Name = "学区结果应用人员", SysRoleGroupId = 3, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  27. new SysRole { Id = 6, Name = "学校管理人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  28. new SysRole { Id = 7, Name = "数据上报人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  29. new SysRole { Id = 8, Name = "结果应用人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
  30. new SysRole { Id = 9, Name = "初中特殊学生审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages=new(){ EducationStage.JUNIOR_HIGH_SCHOOL_STAGE } }) },
  31. new SysRole { Id = 10, Name = "初中缺测替补审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages=new(){ EducationStage.JUNIOR_HIGH_SCHOOL_STAGE } }) },
  32. };
  33. }
  34. }