using EMIS.DataLogic.Repositories; using EMIS.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace EMIS.DataLogic.SystemDAL { public class WechatMPDAL { public WechatSubscribeRepository WechatSubscripbeRepository { get; set; } public RoleRepository RoleRepository { get; set; } public UserRepository UserRepository { get; set; } public IQueryable GetOpenIDList(Expression> roleExp, Expression> userExp) { var sql = (from role in RoleRepository.GetList(roleExp) from user in role.Sys_User from openid in WechatSubscripbeRepository.Entities.Where(x => x.UserID == user.UserID) select openid.OpenID) .Union( from user in UserRepository.GetList(userExp) from openid in WechatSubscripbeRepository.Entities.Where(x => x.UserID == user.UserID) select openid.OpenID ); return sql; } } }