Mybatis----Mapper配置文件


 1 <?xml version="1.0" encoding="UTF-8" ?>
 2 DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 3         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 4 
 5 <mapper namespace="com.orma.mapper.LwlaMapper">
 6 
 7     
 8     <insert id="insertLwla" parameterType="Lwla" >
 9             INSERT INTO lwla(lwla, lwlb, lwlc)
10             VALUES(#{lwla}, #{lwlb}, #{lwlc})
11     insert>
12 
13     
14     <insert id="insertHashMap" parameterType="Map">
15         insert into Lwla(lwla,lwlb,lwlc)
16         values(#{Lwla.lwla},#{Lwla.lwlb},#{Lwla.lwlc})
17     insert>
18 
19     
20     <select id="getUserInfo" resultType="Map">
21         select * from Lwla
22     select>
23 
24 
25     
26     <resultMap id="LwlaResultSet" type="com.orma.model.Lwla">
27         <id property="lwla" column="lwla"/>
28         <result property="lwlb" column="lwlb"/>
29         <result property="lwlc" column="lwlc"/>
30     resultMap>
31     <select id="getLwla" resultMap="LwlaResultSet" parameterType="Lwla">
32             select * from Lwla where lwlc like '%${lwlc}%'
33     select>
34 
35 
36     
37     <select id="getLwla2" resultType="Map" parameterType="Map">
38             select * from Lwla where lwlc like '%${lwlc}%'
39     select>
40 
41 
42     
43     <select id="getLwla3" resultType="Lwla" parameterType="int">
44             select  *  from Lwla where lwla=#{anyname}
45     select>
46 
47 
48     
49     <delete id="deleteLwla" parameterType="int">
50             DELETE FROM Lwla WHERE lwla = #{anyname}
51     delete>
52 
53 
54     
55     <update id="updateLwla" parameterType="Map">
56                 UPDATE Lwla
57                 SET
58                 lwla=#{Lwla.lwla},lwlb=#{Lwla.lwlb},lwlc=#{Lwla.lwlc}
59                 WHERE
60                 lwla = #{oldlwla}
61     update>
62 
63 mapper>