mybatis的xml文件中使用for循环遍历


一般遍历会有两种,一个是单个属性,另外一个是多个属性

单个属性的:

              or

              ( a.account=#{item.account} and  a.name={item.userName} )

           

     

核心就是那个里面的判断,这样写的话第一个就不加or,后面就会拼上or;

这里代码层要先处理userAccountList不能为空,如果为空直接返回,不执行该SQL;