MyBatis in 传参及使用

1. ---Mapper.java
    Type MethodName(@Param("param") List<String> param);
    ## 传参List类型
2. ---Mapper.xml
    <select id="" parameterType="java.lang.String">
        select t.id from table t
        where t.name in
        <foreach item="param" index="index" collection="param" open="(" separator="," close=")">
                #{skuIds,jdbcType=VARCHAR}
        </foreach>
    </select>
    ## collection:List内容
3. ---.java
    List<String> list = new ArrayList<String>();
    list.add("");

    MethodName(list);

猜你喜欢

转载自blog.csdn.net/u012204535/article/details/81661211