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#中IPAddress转换成整型int
    没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))
    VB.NET或C#报错:You must hava a license to use this ActiveX control.
    c#几种随机数组和数组乱序
    C#封装的websocket协议类
    VB生成条形码(EAN-13)
    VB控件间的拖放
    VB用API模拟截屏键PrintScreen
    VB读写进程的内存
    几个VB常见又内涵的错误
  • 原文地址:https://www.cnblogs.com/banzhuan/p/7744332.html
Copyright © 2011-2022 走看看