14ded5d569f8af30c467a26d8d64ebee357fcc7c
[JavaForFun] /
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 <mapper namespace="de.example.mybatis.repository.mapper.AdMapper" >
4
5         <insert id="insert" parameterType="de.example.mybatis.model.Ad">
6                 <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
7                         SELECT LAST_INSERT_ID()
8                 </selectKey>
9                         INSERT into ad (
10                                 company_id,
11                                 company_categ_id,
12                                 ad_mobile_image,
13                                 created_at,
14                                 updated_at,
15                                 ad_gps
16                         )
17                         VALUES (
18                                 #{companyId,jdbcType=BIGINT},
19                                 #{companyCategId,jdbcType=BIGINT},
20                                 #{adMobileImage,jdbcType=VARCHAR},
21                                 #{createdAt,jdbcType=TIMESTAMP},
22                                 #{updatedAt,jdbcType=TIMESTAMP},
23                                 #{adGps,jdbcType=LONGVARBINARY}
24                         )
25         </insert>
26
27
28         <update id="updateByPrimaryKey" parameterType="de.example.mybatis.model.Ad">
29             UPDATE
30                 ad
31             SET
32                 company_id = #{companyId,jdbcType=BIGINT},
33                 company_categ_id = #{companyCategId,jdbcType=BIGINT},
34                 ad_mobile_image = #{adMobileImage,jdbcType=VARCHAR},
35                 created_at = #{createdAt,jdbcType=TIMESTAMP},
36                 updated_at = #{updatedAt,jdbcType=TIMESTAMP}
37             WHERE
38                 id = #{id,jdbcType=BIGINT}
39         </update>
40
41
42         <select id="selectAsList" resultType="de.example.mybatis.model.Ad"
43                 flushCache="false" useCache="true" timeout="10000" statementType="PREPARED">
44                 select * FROM ad
45         </select>
46   
47
48         <select id="selectAsSet" resultType="de.example.mybatis.model.Ad"
49          flushCache="false" useCache="true" timeout="10000" statementType="PREPARED">
50                 select * FROM ad
51         </select>
52 </mapper>