WechatMPDAL.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. using EMIS.DataLogic.Repositories;
  2. using EMIS.Entities;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Linq.Expressions;
  7. using System.Text;
  8. namespace EMIS.DataLogic.SystemDAL
  9. {
  10. public class WechatMPDAL
  11. {
  12. public WechatSubscribeRepository WechatSubscripbeRepository { get; set; }
  13. public RoleRepository RoleRepository { get; set; }
  14. public UserRepository UserRepository { get; set; }
  15. public IQueryable<string> GetOpenIDList(Expression<Func<Sys_Role, bool>> roleExp, Expression<Func<Sys_User, bool>> userExp)
  16. {
  17. var sql = (from role in RoleRepository.GetList(roleExp)
  18. from user in role.Sys_User
  19. from openid in WechatSubscripbeRepository.Entities.Where(x => x.UserID == user.UserID)
  20. select openid.OpenID)
  21. .Union(
  22. from user in UserRepository.GetList(userExp)
  23. from openid in WechatSubscripbeRepository.Entities.Where(x => x.UserID == user.UserID)
  24. select openid.OpenID
  25. );
  26. return sql;
  27. }
  28. }
  29. }