Mybats mapper配置

 1 <?xml version="1.0" encoding="UTF-8" ?>
 2 <!DOCTYPE mapper
 3   PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 4   "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 5 //接口MAPPER下完成的包名+类名
 6   <mapper namespace="org.demo.test4api.mapper.UserMapper">
 7     <!--通用的一些增删查改-->
 8     <insert id="insert">
 9         insert into t_user (username,birthday,age) 
10         values (#{username},#{birthday},#{age})
11     </insert>
12     
13     <update id="updateByPrimaryKey">
14         update t_user set
15           username=#{username},
16           birthday=#{birthday},
17           age=#{age}
18          where id=#{id}
19     </update>
20     
21     <delete id="deleteByPrimaryKey">
22         delete from t_user where id=#{id}
23     </delete>
24     
25     <select id="selectByPrimaryKey" resultType="User">
26         select id,username,birthday,age from t_user where id=#{id}
27     </select>
28     
29     <select id="selectList" resultType="User">
30         select id,username,birthday,age from t_user order by id asc
31     </select>
32 </mapper>

 

posted on 2015-08-14 16:15  换言色  阅读(266)  评论(0)    收藏  举报

导航