SysRoleRepository.cs 606 B

12345678910111213141516171819202122
  1. using ERP.Core.Entities;
  2. using ERP.Framework.WebApi;
  3. namespace ERP.Core.Repositorys
  4. {
  5. public class SysRoleRepository : BaseRepository<SysRole, CoreDbContext>
  6. {
  7. public SysRoleRepository(CoreDbContext context) : base(context)
  8. {
  9. }
  10. public List<SysRole> SelectRoleListByUserId(long userId)
  11. {
  12. var q = from ur in Context.Set<SysUserRole>()
  13. join r in Context.Set<SysRole>() on ur.RoleId equals r.Id
  14. where ur.UserId.Equals(userId)
  15. select r;
  16. return q.ToList();
  17. }
  18. }
  19. }