SSM框架之使用MyBatis Generator自動建立程式碼
阿新 • • 發佈:2019-01-06
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="lcw.dao.MessgaeMapper" > 4 <resultMap id="BaseResultMap" type="lcw.model.Messgae" > 5 <id column="id" property="id" jdbcType="INTEGER" /> 6 <result column="title" property="title" jdbcType="VARCHAR" /> 7 <result column="describe" property="describe" jdbcType="VARCHAR" /> 8 <result column="content" property="content" jdbcType="VARCHAR" /> 9 </resultMap> 10 <sql id="Base_Column_List" > 11 id, title, describe, content 12 </sql> 13 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 14 select 15 <include refid="Base_Column_List" /> 16 from message 17 where id = #{id,jdbcType=INTEGER} 18 </select> 19 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > 20 delete from message 21 where id = #{id,jdbcType=INTEGER} 22 </delete> 23 <insert id="insert" parameterType="lcw.model.Messgae" > 24 insert into message (id, title, describe, 25 content) 26 values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR}, 27 #{content,jdbcType=VARCHAR}) 28 </insert> 29 <insert id="insertSelective" parameterType="lcw.model.Messgae" > 30 insert into message 31 <trim prefix="(" suffix=")" suffixOverrides="," > 32 <if test="id != null" > 33 id, 34 </if> 35 <if test="title != null" > 36 title, 37 </if> 38 <if test="describe != null" > 39 describe, 40 </if> 41 <if test="content != null" > 42 content, 43 </if> 44 </trim> 45 <trim prefix="values (" suffix=")" suffixOverrides="," > 46 <if test="id != null" > 47 #{id,jdbcType=INTEGER}, 48 </if> 49 <if test="title != null" > 50 #{title,jdbcType=VARCHAR}, 51 </if> 52 <if test="describe != null" > 53 #{describe,jdbcType=VARCHAR}, 54 </if> 55 <if test="content != null" > 56 #{content,jdbcType=VARCHAR}, 57 </if> 58 </trim> 59 </insert> 60 <update id="updateByPrimaryKeySelective" parameterType="lcw.model.Messgae" > 61 update message 62 <set > 63 <if test="title != null" > 64 title = #{title,jdbcType=VARCHAR}, 65 </if> 66 <if test="describe != null" > 67 describe = #{describe,jdbcType=VARCHAR}, 68 </if> 69 <if test="content != null" > 70 content = #{content,jdbcType=VARCHAR}, 71 </if> 72 </set> 73 where id = #{id,jdbcType=INTEGER} 74 </update> 75 <update id="updateByPrimaryKey" parameterType="lcw.model.Messgae" > 76 update message 77 set title = #{title,jdbcType=VARCHAR}, 78 describe = #{describe,jdbcType=VARCHAR}, 79 content = #{content,jdbcType=VARCHAR} 80 where id = #{id,jdbcType=INTEGER} 81 </update> 82 </mapper>