问题描述
publicListResponse<Model.SuppliersOrderDetail>GetPageList(Model.SuppliersOrderDetailmodel,DBUtility.PageModelpageModel){varcontext=db.Select<Model.SuppliersOrderDetail>();ListResponse<Model.SuppliersOrderDetail>list=context.QueryPaging(pageModel);returnlist;}怎么能让Select出来的数据中的GoodsTitle字段相同的内容分组然后number字段数字相加按总量排序
解决方案
解决方案二:
groupby分组orderby排序
解决方案三:
ListResponse<Model.SuppliersOrderDetail>list=context.QueryPaging(pageModel),GroupBy(x=>x,产品名称).Select(x=>newModel.SuppliersOrderDetail{产品名称=x.Key,数量=x.Sum(y=>y.数量)}).ToList();
时间: 2024-09-20 00:02:49