映射文件
在User.xml中配置添加用户的sql(mappedStatement),
<!-- 添加用户
parameterType:指定输入参数类型是pojo(包括用户信息) User实体类所处的位置
#{} 中指定pojo的属性名,接收到pojo对象的属性值,mybatis通过OGNL获取对象的属性值
-->
<insert id="insertUser" parameterType="cn.itcost.mybatis.po.User">
insert into user(id,username,birthday,sex,address) value(#{id},#{username},#{birthday},#{sex},#{address})
</insert>
程序代码