MyBatis Mapper.xml文件模板
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cdslut.propertymanager.dao.LoginDao">

    <resultMap id="BaseResultMap" type="com.cdslut.propertymanager.entity">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="stu_name" jdbcType="VARCHAR" property="stuName" />
        <result column="stu_age" jdbcType="INTEGER" property="stuAge" />
    </resultMap>

    <sql id="Base_Column_List">
        id, stu_name, stu_age
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from t_student
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from t_student
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="com.example.springbootworkspace.model.Student">
        insert into t_student (id, stu_name, stu_age
        )
        values (#{id,jdbcType=INTEGER}, #{stuName,jdbcType=VARCHAR}, #{stuAge,jdbcType=INTEGER}
        )
    </insert>
    <insert id="insertSelective" parameterType="com.example.springbootworkspace.model.Student">
        insert into t_student
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="stuName != null">
                stu_name,
            </if>
            <if test="stuAge != null">
                stu_age,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="stuName != null">
                #{stuName,jdbcType=VARCHAR},
            </if>
            <if test="stuAge != null">
                #{stuAge,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.example.springbootworkspace.model.Student">
        update t_student
        <set>
            <if test="stuName != null">
                stu_name = #{stuName,jdbcType=VARCHAR},
            </if>
            <if test="stuAge != null">
                stu_age = #{stuAge,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.example.springbootworkspace.model.Student">
        update t_student
        set stu_name = #{stuName,jdbcType=VARCHAR},
        stu_age = #{stuAge,jdbcType=INTEGER}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇