gpt4 book ai didi

java - 动态mybatis xml查询

转载 作者:行者123 更新时间:2023-12-02 10:54:37 26 4
gpt4 key购买 nike

需要有关以下动态查询的帮助:

if country==null OR country != (spain || Peru)
select * from emp where country NOT IN (spain,Peru)
else
select * from emp where country=#{country}

我尝试过类似的方法,但没有帮助:

<when test="country ==null" or country !='spain' or country != 'Peru'">
AND country NOT IN ('spain','peru')
</when>
<otherwise>
AND country=#{country}
</otherwise>

即使国家/地区=美国,也始终生成 NOT IN

最佳答案

试试这个test="country == null或country != '西类牙'或country != 'UK' "

关于java - 动态mybatis xml查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51868684/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com