mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Fixing recycle bin error.
Unfortunately we can't sort by ModifiedUtc without grouping by it. The problem with grouping by ModifiedUtc i that it will cause to show items that are no longer deleted. I think we need a Deleted flag.
This commit is contained in:
@@ -70,16 +70,13 @@ namespace Orchard.AuditTrail.Services {
|
||||
// Select only the highest versions where both Published and Latest are false.
|
||||
var select =
|
||||
"select max(ContentItemVersionRecord.Id), ContentItemVersionRecord.ContentItemRecord.Id, max(ContentItemVersionRecord.Number) " +
|
||||
"from Orchard.ContentManagement.Records.ContentItemVersionRecord ContentItemVersionRecord " +
|
||||
"join ContentItemVersionRecord.ContentItemRecord ContentItemRecord, Orchard.Core.Common.Models.CommonPartVersionRecord CommonPartVersionRecord " +
|
||||
"where CommonPartVersionRecord.Id = ContentItemVersionRecord.Id ";
|
||||
"from Orchard.ContentManagement.Records.ContentItemVersionRecord ContentItemVersionRecord ";
|
||||
|
||||
var filter = contentItemIds != null ? "and ContentItemVersionRecord.ContentItemRecord.Id in (:ids) " : default(String);
|
||||
|
||||
var group =
|
||||
"group by ContentItemVersionRecord.ContentItemRecord.Id " +
|
||||
"having max(cast(Latest as Int32)) = 0 and max(cast(Published as Int32)) = 0 " +
|
||||
"order by max(CommonPartVersionRecord.ModifiedUtc) desc ";
|
||||
"having max(cast(Latest as Int32)) = 0 and max(cast(Published as Int32)) = 0 ";
|
||||
|
||||
var hql = String.Concat(select, filter, group);
|
||||
var query = session.CreateQuery(hql);
|
||||
|
||||
Reference in New Issue
Block a user