我有以下代码:
var classAttendanceDetails =
Session.QueryOver<StudentClassAttendanceDetails>(() => scadAlias)
.JoinAlias(() => scadAlias.StudentClassAttendence, () => scaAlias)
.JoinAlias(() => scaAlias.Lecture, () => lAlias).JoinAlias(() => scaAlias.Teacher, () => tAlias).JoinAlias(() => scadAlias.StudentProgram, () => spAlias);
var queryover = classAttendanceDetails
.Select(
Projections.Group<StudentClassAttendanceDetails>(c => scaAlias.Lecture),
Projections.Group<StudentClassAttendanceDetails>(c => scaAlias.Teacher),
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback == 1),
Projections.Constant(1),
Projections.Constant(0))),
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback == 2),
Projections.Constant(1),
Projections.Constant(0))),
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback == 3),
Projections.Constant(1),
Projections.Constant(0))),
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(
f => f.StudentFeedback.IsIn(new[] {1, 2, 3})),
Projections.Constant(1),
Projections.Constant(0))),
Projections.SqlFunction(
new VarArgsSQLFunction("(", "/", ")"),
NHibernateUtil.Int32,
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback == 1),
Projections.Constant(1),
Projections.Constant(0))),
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback.IsIn(new[] { 1, 2, 3 })),
Projections.Constant(1),
Projections.Constant(0)))
).OrderBy(Projections.SqlFunction(
new VarArgsSQLFunction("(", "/", ")"),
NHibernateUtil.Int32,
Projections.Sum(
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback == 1),
Projections.Constant(1),
Projections.Constant(0))),
Projections.Conditional(
Restrictions.Where<StudentClassAttendanceDetails>(f => f.StudentFeedback.IsIn(new[] { 1, 2, 3 })),
Projections.Constant(1),
Projections.Constant(0)))).Desc;
在这里,我试图按结果数量排序结果,其中反馈是1,由反馈为1/2 / 3的结果没有划分。但我不能按此排序,因为它不包含在组中。我如何将其包含在
组中