多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` <sql id="query_user_where"> <if test="user != null"> <if test="user.username != null and user.username != ''"> AND username like '%${user.username}%' </if> </if> <if test="ids != null and ids.size() > 0"> <!-- collection:指定输入的集合参数的参数名称 --> <!-- item:声明集合参数中的元素变量名 --> <!-- open:集合遍历时,需要拼接到遍历sql语句的前面 --> <!-- close:集合遍历时,需要拼接到遍历sql语句的后面 --> <!-- separator:集合遍历时,需要拼接到遍历sql语句之间的分隔符号 --> <foreach collection="ids" item="id" open=" AND id IN ( " close=" ) " separator=","> #{id} </foreach> </if> </sql> ```