SysRoleRepository.cs 823 B

123456789101112131415161718192021222324252627282930
  1. using ERP.Core.Dto;
  2. using ERP.Core.Entity;
  3. using ERP.Framework.WebApi;
  4. using Microsoft.EntityFrameworkCore;
  5. using Microsoft.EntityFrameworkCore.Internal;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace ERP.Core.Repository
  12. {
  13. public class SysRoleRepository : BaseRepository<SysRole, CoreDbContext>
  14. {
  15. public SysRoleRepository(CoreDbContext context) : base(context)
  16. {
  17. }
  18. public List<SysRole> SelectRoleListByUserId(long userId)
  19. {
  20. var q = from ur in Context.Set<SysUserRole>()
  21. join r in Context.Set<SysRole>() on ur.RoleId equals r.Id
  22. where ur.UserId.Equals(userId)
  23. select r;
  24. return q.ToList();
  25. }
  26. }
  27. }