if(null == sorter){ hql.append(" order by m.mDate desc,case when m.mealTime = ‘morning‘ then ‘1‘ when m.mealTime = ‘noon‘ then ‘2‘ when m.mealTime = ‘night‘ then ‘3‘ when m.mealTime = ‘midnight‘ then ‘4‘ end "); }
注:
上面hql语句的意思可以理解为:
通过mDate 降序排序,同时还得满足当mealTime = ‘morning‘ 时,在日期的基础上排第一位,当mealTime = ‘noon‘ 同理,以此类推即可。
如有疑问请留言,谢谢!
时间: 2024-10-09 19:02:00