zoukankan      html  css  js  c++  java
  • ssm笔记1

    mybatis的SQL语句:

    <mapper namespace="cn.wh.mapper.EmployeeMapper" >
    <resultMap id="BaseResultMap" type="cn.wh.pojo.Employee" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="gender" property="gender" jdbcType="VARCHAR" />
    <result column="depId" property="depid" jdbcType="INTEGER" />
    </resultMap>
    <sql id="Base_Column_List" >
    id, sn, name, gender, depId
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    from employee
    where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from employee
    where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="cn.wh.pojo.Employee" >
    insert into employee (id, sn, name,
    gender, depId)
    values (#{id,jdbcType=INTEGER}, #{sn,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
    #{gender,jdbcType=VARCHAR}, #{depid,jdbcType=INTEGER})
    </insert>
    <insert id="insertSelective" parameterType="cn.wh.pojo.Employee" >
    insert into employee
    <trim prefix="(" suffix=")" suffixOverrides="," >
    <if test="id != null" >
    id,
    </if>
    <if test="sn != null" >
    sn,
    </if>
    <if test="name != null" >
    name,
    </if>
    <if test="gender != null" >
    gender,
    </if>
    <if test="depid != null" >
    depId,
    </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
    <if test="id != null" >
    #{id,jdbcType=INTEGER},
    </if>
    <if test="sn != null" >
    #{sn,jdbcType=VARCHAR},
    </if>
    <if test="name != null" >
    #{name,jdbcType=VARCHAR},
    </if>
    <if test="gender != null" >
    #{gender,jdbcType=VARCHAR},
    </if>
    <if test="depid != null" >
    #{depid,jdbcType=INTEGER},
    </if>
    </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="cn.wh.pojo.Employee" >
    update employee
    <set >
    <if test="sn != null" >
    sn = #{sn,jdbcType=VARCHAR},
    </if>
    <if test="name != null" >
    name = #{name,jdbcType=VARCHAR},
    </if>
    <if test="gender != null" >
    gender = #{gender,jdbcType=VARCHAR},
    </if>
    <if test="depid != null" >
    depId = #{depid,jdbcType=INTEGER},
    </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="cn.wh.pojo.Employee" >
    update employee
    set sn = #{sn,jdbcType=VARCHAR},
    name = #{name,jdbcType=VARCHAR},
    gender = #{gender,jdbcType=VARCHAR},
    depId = #{depid,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
    </update>
    </mapper>

  • 相关阅读:
    [C# 基础知识系列]专题六:泛型基础篇——为什么引入泛型
    [C#基础知识系列]专题十七:深入理解动态类型
    [C# 基础知识系列]专题九: 深入理解泛型可变性
    C#网络编程系列文章索引
    [C#基础知识系列]专题十:全面解析可空类型
    [C# 基础知识系列]专题十一:匿名方法解析
    [C# 基础知识系列]专题十六:Linq介绍
    VSTO之旅系列(一):VSTO入门
    [C# 网络编程系列]专题七:UDP编程补充——UDP广播程序的实现
    [C# 网络编程系列]专题四:自定义Web浏览器
  • 原文地址:https://www.cnblogs.com/banzhuan/p/7744332.html
Copyright © 2011-2022 走看看