
<if test="plantNameList.size > 0">
and (m.plant_name in
<foreach collection="plantNameList" index="index" item="plantName" open="(" separator="," close=")">
#{plantName}
</foreach>
or m.fourth_name in
<foreach collection="plantNameList" index="index" item="plantName" open="(" separator="," close=")">
#{plantName}
</foreach>)
</if>
想看sql语句可以到我的主页查找👇
https://blog.youkuaiyun.com/chenkunNB/article/details/123498599?spm=1001.2014.3001.5501
这篇博客探讨了在Java中动态构建SQL查询语句的技巧,特别是如何使用if和foreach标签处理列表条件。文章通过示例展示了如何根据plantNameList列表内容拼接'in'查询,用于过滤植物名称。对于需要动态构建复杂SQL查询的开发者来说,这是一个实用的指南。
3551

被折叠的 条评论
为什么被折叠?



