| | |
| | | oldModel.createBy = entity.createBy; |
| | | oldModel.upDataBy = entity.upDataBy; |
| | | oldModel.isdelete = entity.isdelete; |
| | | oldModel.shoukuannums = entity.shoukuannums; |
| | | oldModel.shoukuanamount = entity.shoukuanamount; |
| | | |
| | | //事物处理过程结束 |
| | | var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); |
| | |
| | | goodsId = p.goodsId, |
| | | goodsName = p.goodsName, |
| | | productsId = p.productsId, |
| | | productsName = p.productsName, |
| | | productsName = p.productsName +" " + p.spesDesc, |
| | | spesDesc = p.spesDesc, |
| | | price = p.price, |
| | | nums = p.nums, |
| | |
| | | goodsId = p.goodsId, |
| | | goodsName = p.goodsName, |
| | | productsId = p.productsId, |
| | | productsName = p.productsName, |
| | | productsName = p.productsName + " " + p.spesDesc, |
| | | spesDesc = p.spesDesc, |
| | | price = p.price, |
| | | nums = p.nums, |
| | |
| | | |
| | | }).ToPageListAsync(pageIndex, pageSize, totalCount); |
| | | } |
| | | |
| | | foreach (var puhuo in page) |
| | | { |
| | | var distribution = await DbClient.Queryable<CoreCmsDistribution>().In(puhuo.distributionId).WithNoLockOrNot(blUseNoLock).WithCacheIF(false).SingleAsync(); |
| | | if (distribution !=null) |
| | | { |
| | | puhuo.schoolName = distribution.schoolName; |
| | | } |
| | | } |
| | | |
| | | var list = new PageList<Puhuo>(page, pageIndex, pageSize, totalCount); |
| | | return list; |
| | | } |
| | |
| | | /// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param> |
| | | /// <returns></returns> |
| | | public async Task<IPageList<Puhuo>> QueryPageGroupAsync(Expression<Func<Puhuo, bool>> predicate, |
| | | Expression<Func<Puhuo, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1, |
| | | Expression<Func<Puhuo, object>> orderByExpression, OrderByType orderByType, OtherData otherData, int pageIndex = 1, |
| | | int pageSize = 20, bool blUseNoLock = false) |
| | | { |
| | | RefAsync<int> totalCount = 0; |
| | |
| | | if (blUseNoLock) |
| | | { |
| | | page = await DbClient.Queryable<Puhuo>() |
| | | .GroupBy(it => new { it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price }) |
| | | .GroupBy(it => new { it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price ,it.spesDesc }) |
| | | .WhereIF(predicate != null, predicate) |
| | | .Select(p => new Puhuo |
| | | { |
| | |
| | | goodsId = p.goodsId, |
| | | goodsName = p.goodsName, |
| | | productsId = p.productsId, |
| | | productsName = p.productsName, |
| | | productsName = p.productsName + " " + p.spesDesc, |
| | | price = p.price, |
| | | tiaozhengnums =SqlFunc.AggregateCount(p.id), |
| | | nums = SqlFunc.AggregateSum(p.nums), |
| | |
| | | .MergeTable()//需要加MergeTable才能排序统计过的列 |
| | | .OrderByIF(orderByExpression != null, orderByExpression, orderByType) |
| | | .With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); |
| | | |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | goodsId = p.goodsId, |
| | | goodsName = p.goodsName, |
| | | productsId = p.productsId, |
| | | productsName = p.productsName, |
| | | productsName = p.productsName + " " + p.spesDesc, |
| | | price = p.price, |
| | | tiaozhengnums = SqlFunc.AggregateCount(p.id), |
| | | nums = SqlFunc.AggregateSum(p.nums), |
| | |
| | | .OrderByIF(orderByExpression != null, orderByExpression, orderByType) |
| | | .ToPageListAsync(pageIndex, pageSize, totalCount); |
| | | } |
| | | |
| | | |
| | | var pagetotal = DbClient.Queryable<Puhuo>() |
| | | // .GroupBy(it => new { it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price }) |
| | | .WhereIF(predicate != null, predicate) |
| | | .Select(p => new Puhuo |
| | | { |
| | | tiaozhengnums = SqlFunc.AggregateCount(p.id), |
| | | nums = SqlFunc.AggregateSum(p.nums), |
| | | amount = SqlFunc.AggregateSum(p.amount), |
| | | }) |
| | | .First(); // 或者使用 Single/FirstOrDefault 等方法获取结果 |
| | | //.Select(p => new Puhuo |
| | | //{ |
| | | // tiaozhengnums = SqlFunc.AggregateCount(p.id), |
| | | // nums = SqlFunc.AggregateSum(p.nums), |
| | | // amount = SqlFunc.AggregateSum(p.amount), |
| | | |
| | | |
| | | //}); |
| | | |
| | | otherData.heji4 = pagetotal.nums; |
| | | otherData.heji5 = pagetotal.amount; |
| | | otherData.heji6 = pagetotal.tiaozhengnums; |
| | | |
| | | var list = new PageList<Puhuo>(page, pageIndex, pageSize, totalCount); |
| | | return list; |
| | | } |