分页统计排序错误! 返回

SqlSugar 沟通中
2 327
该叫什么 阿牧 发布于2025/12/1
悬赏:0 飞吻
            var timer_list = db.Queryable<iCore.Model.Timer>().Where(exp.ToExpression()).Select(it => new iCore.Model.Timer
            {
                ID = it.ID.selectAll(),
                CreateTime = it.CreateTime,
                vThisCount = SqlFunc.DateDiff(DateType.Second, it.StartTime, DateTime.Now),
                vUseTimeCount = SqlFunc.Subqueryable<iCore.Model.TimerLog>().Where(s => s.ShopID == it.ShopID && s.TimerID == it.ID).Sum(s => s.UseTimeCount)

            }).OrderBy(it=>it.CreateTime, OrderByType.Desc).ToPageList(pageIndex, pageSize, ref totalCount);
vUseTimeCount = SqlFunc.Subqueryable<iCore.Model.TimerLog>().Where(s => s.ShopID == it.ShopID && s.TimerID == it.ID).Sum(s => s.UseTimeCount)

加上这句,排序就不正常。不管怎么排都是正序,为什么?

热忱回答2