5. Mybatis UPDATE更新,DELETE删除
案例:
1. update
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.accp.mybatis.model.Blog"> <update id="updateBlog" parameterType="Blog"> UPDATE Blog SET title = #{title}, author_id = #{author.id}, WHERE id = #{id}; </update> </mapper>
2. delete
<delete id="deleteBlog" parameterType="Blog"> DELETE FROM BLOG WHERE ID = #{id} </delete>
update、delete语句属性配置细节:
不要小瞧女程序员