java学习知识积累-初练Mybatis
Mybatis在xml文件处理简单的增删改查操作。、 对应的数据库表结构是这样的: xml代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<insert id="insertUser" parameterType="User" useGeneratedKeys="true" keyColumn="id"> insert into t_user(name, age) values(#{name}, #{age}) </insert> <update id="updateUser" parameterType="User"> update t_user set name=#{name}, age=#{age} where id=#{id} </update> <select id="findById" parameterType="int" resultType="User"> select * from t_user where id=#{id} </select> <delete id="deleteUser" parameterType="int"> delete from t_user where id=#{id} </delete> |
UserMappe…
Read more