mapper.xml-foreach应用场景: curd-批量处理, 拼接等

mapper.java

 int deleteRelationsByRoleids(@Param("roleids") Integer[] roleids);

mapper.xml

    <delete id="deleteRelationsByRoleids">
        DELETE FROM user_role
        WHERE
        role_id in
        <foreach collection="roleids" item="item" index="index" open="(" separator="," close=")">
            #{item,jdbcType=INTEGER}
        </foreach>
    </delete>
上一篇:关于反射机制的个人理解


下一篇:mybatis-plus 代码生成工具-CURD 实践