Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA如何讲in查询返回的结果按in传入照顺序返回? #54

Open
shihp opened this issue Dec 9, 2022 · 1 comment
Open

JPA如何讲in查询返回的结果按in传入照顺序返回? #54

shihp opened this issue Dec 9, 2022 · 1 comment

Comments

@shihp
Copy link

shihp commented Dec 9, 2022

没找到非native的xiefa

直接用mysql native语法可以做到
SELECT * from models where id in (26612,26611,26610) order by field(id,26612,26611,26610);

@query(value = "select * from dress where id in (?1) and source = ?2 order by field(id,?3)", nativeQuery = true)
List queryDid(List dids, Integer code, List dids2);

@zhangzhenhuajack
Copy link
Owner

JPQL比较难,看你的顺序不是 order by Desc ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants