ef join查询

            temp = temp.OrderByDescending(s => s.CreateTime).Skip((param.PageIndex - ) * param.PageSize).Take(param.PageSize);

var result = from u in temp.ToList()
join t in users on u.SendUserId equals t.UserId into sendUser
from s in sendUser.DefaultIfEmpty()
select new
{
u.DiamondId,
CreateTime = u.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
u.Num,
IsAgenter = u.UserInfo.IsAgenter ? "是" : "否",
u.UserInfo.Name,
u.UserInfo.Phone,
Type=((Model.Enums.DiamondRecordType)u.Type).ToString(),
SendName=s==null?"":s.Name
};
上一篇:JAVA 网络编程 - 实现 群聊 程序


下一篇:Java架构师技能发展脑图