Linq 多连接及 left join 实例 记录
var retList = from d in mbExList.Cast<MaterialBaseEx>().ToList()
join c in umcList.Cast<ClassifyBaseEx>().ToList() on d.ClsCode equals c.ClsCode
join b in collectItem.Cast<CollectItem>().ToList() on d.Guid equals b.MatID into temp
join e in mlpList.Cast<MaterialLastPrice>().ToList() on d.MatCode equals e.MatCode into tempxx
from tt in temp.DefaultIfEmpty()
from xx in tempxx.DefaultIfEmpty()
where (d.IsPublish.Equals(true)) || tt != null
select new MaterialPriceCollect
{
Guid = Guid.NewGuid().ToString(),
MatCode = d.MatCode,
//Area = areaRec.Text,
PriceType = 1,
State = 2,
MatName = d.MatName==null?"":d.MatName,
Unit = d.MatUnit == null ? "" : d.MatUnit,
MatType = d.MatModel == null ? "" : d.MatModel,
LastPrice = (xx==null || xx.LastPrice == null) ? 0 : xx.LastPrice,
UserId = "_" + userId + ",",
MatId = d.Guid == null ? "" : d.Guid,
IsFrequently = (int)EumIsFrequently.否,
//ReportTime = DateTime.Now,
Weight = (tt==null ||tt.Weight == null) ? 1 : tt.Weight,
//AreaCode = areaRec.Id,
//PeriodNo = objMat.CurPeriodNo,
};
最新文章
- map、Array工具类,来源于东宏软件
- [U3D 添加大地、天空,用第一视角看看自己做的世界]
- XSS 跨站脚本攻击之构造剖析(一)
- nginx 支持pathinfo的配置文件
- BZOJ 3527 力
- 大数据查询——HBase读写设计与实践
- SQL基础学习_04_视图
- Spring MVC执行的流程
- Go 语言接口
- wifi探针的使用说明.
- layui 常见的表单元素
- Redis 学习手册
- 使用python3.6和django1.9的xadmin 遇到坑,__unicode__()和__str__()
- poj3114 Contries in War (tarjan+dijkstra)
- Dubbo 实例
- 学号20155311 2016-2017-2 《Java程序设计》第9周学习总结
- Win32 消息响应顺序
- Java常用的异常类型
- Spring MVC中如何解决POST请求中文乱码问题,GET的又如何处理呢
- [PyTorch]PyTorch中模型的参数初始化的几种方法(转)
热门文章
- 存储过程中SELECT INTO的使用
- hudson.AbortException: No files found in path D:\testproject\project2\testoutput\ with configured filemask: output.xml
- 使用 requests 维持会话
- Oracle的闪回技术--闪回已删除的表
- sine曲线向前运动
- api 25 PopupWindow会占据整个屏幕
- 【LeetCode OJ】Add Two Numbers
- iOS 事件的产生、传递、响应
- Android中实现定时器的3中方法
- 云计算设计模式(六)——命令和查询职责分离(CQRS)模式