Mybtis中foreach遍历数组和集合动态拼接sql

Mybtis中foreach遍历数组和集合动态拼接sql

<select id="test" parameterType="java.util.List"  resultMap="Student">  
               
    select id,name from test_table where id in  
    <foreach collection="list_tests" index="index" item="item" open="(" separator="," close=")">  
        #{item}  
    foreach>  
select> 

你可能感兴趣的:(Mysql)