go-gorm / gen

Gen: Friendly & Safer GORM powered by Code Generation
https://gorm.io/gen/
MIT License
2.26k stars 295 forks source link

Order by 时能否使用case when #1028

Open Ambition9186 opened 11 months ago

Ambition9186 commented 11 months ago

想要排序时根据一组值置顶: SELECT * FROM user ORDER BY CASE WHEN id IN (13349, 13348, 13347,13346,13345,13344,13343,13342,13341) THEN 0 ELSE 1 END,id;

silver-brother commented 11 months ago
image

可以自己实现

xuyang404 commented 1 month ago

image 可以自己实现

这个并不能返回Dao