ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
insert、delete、update 均没有 resultType 属性,但它们都有返回一个int 整数,表示影响了数据表的多少行。 <br/> **1. DAO 层接口** ```java public interface StudentDao { int insert(Student student); int deleteById(@Param("id") Integer id); int updateById(Student student); } ``` **2. XML映射文件** ```xml <insert id="insert" parameterType="Student"> insert into student values(#{id}, #{name}, #{born}, #{gender}) </insert> <delete id="deleteById" parameterType="integer"> delete from student where id=#{id} </delete> <update id="updateById" parameterType="Student"> update student set `name`=#{name},born=#{born},gender=#{gender} where id=#{id} </update> ``` **** 更多用法参数文档:https://mybatis.org/mybatis-3/zh/sqlmap-xml.html#insert_update_and_delete