/*********************************************************************** * Project: baifenBinfa * ProjectName: 百分兵法管理系统 * Web: http://chuanyin.com * Author: * Email: * CreateTime: 202403/02 * Description: 暂无 ***********************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using CoreCms.Net.Configuration; using CoreCms.Net.IRepository; using CoreCms.Net.IRepository.UnitOfWork; using CoreCms.Net.Loging; using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Helper; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Newtonsoft.Json; using SqlSugar; namespace CoreCms.Net.Repository { /// /// 发货单表 接口实现 /// public class CoreCmsBillDeliveryRepository : BaseRepository, ICoreCmsBillDeliveryRepository { public CoreCmsBillDeliveryRepository(IUnitOfWork unitOfWork) : base(unitOfWork) { } /// /// 发货单统计7天统计 /// /// public async Task> Statistics() { var dt = DateTime.Now.AddDays(-8); var list = await DbClient.Queryable() .Where(p => p.createTime >= dt) .Select(it => new { it.deliveryId, createTime = it.createTime.Date }) .MergeTable() .GroupBy(it => it.createTime) .Select(it => new StatisticsOut { day = it.createTime.ToString("yyyy-MM-dd"), nums = SqlFunc.AggregateCount(it.deliveryId) }) .ToListAsync(); return list; } } }