扫码关注官方订阅号
闭关修行中......
问题已解决,在MyBatis的xml中替换成了when标签,并且在判断时,将判断的值加上toString(),参数名为_parameter,不需要指定成传入的参数名,参考代码如下:
<select id="getLoop" resultMap="AAA" parameterType="String"> SELECT *, ROWNUM RN from tablename <where> <choose> <when test="_parameter != null and _parameter == '1'.toString()"> RN <=100000 and RN >=1 </when> <when test="_parameter != null and _parameter == '2'.toString()"> RN <=200000 and RN >=100001 </when> <when test="_parameter != null and _parameter == '3'.toString()"> RN <=300000 and RN >=200001 </when> <otherwise> RN <=1 and RN >=1 </otherwise> </choose> </where> </select>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
问题已解决,在MyBatis的xml中替换成了when标签,并且在判断时,将判断的值加上toString(),参数名为_parameter,不需要指定成传入的参数名,参考代码如下: