mapper.xml
来源:互联网 发布:500px哪些摄影师 知乎 编辑:程序博客网 时间:2024/06/04 19:01
<?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="cn.emay.emas.dao.UsrMapper" >
<resultMap id="BaseResultMap" type="cn.emay.emas.entity.Usr" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, username, password, description
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from usr
where id = #{id,jdbcType=INTEGER}
</select>
<select id="findAll" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"/>
from usr
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from usr
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.emay.emas.entity.Usr" >
insert into usr (id, username, password,
description)
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cn.emay.emas.entity.Usr" >
insert into usr
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="username != null" >
username,
</if>
<if test="password != null" >
password,
</if>
<if test="description != null" >
description,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="description != null" >
#{description,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.emay.emas.entity.Usr" >
update usr
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.emay.emas.entity.Usr" >
update usr
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.emay.emas.dao.UsrMapper" >
<resultMap id="BaseResultMap" type="cn.emay.emas.entity.Usr" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, username, password, description
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from usr
where id = #{id,jdbcType=INTEGER}
</select>
<select id="findAll" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"/>
from usr
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from usr
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.emay.emas.entity.Usr" >
insert into usr (id, username, password,
description)
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cn.emay.emas.entity.Usr" >
insert into usr
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="username != null" >
username,
</if>
<if test="password != null" >
password,
</if>
<if test="description != null" >
description,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="description != null" >
#{description,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.emay.emas.entity.Usr" >
update usr
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.emay.emas.entity.Usr" >
update usr
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
阅读全文
0 0
- mapper.xml
- mybatis Mapper.xml 详解
- Mapper XML 文件
- mybatis mapper.xml
- Mapper XML Files详解
- mapper.xml内容解析
- Mapper XML 文件
- Mapper XML文件
- Mybatis(五)-Mapper.xml
- Mapper.xml解析
- Mapper XML 文件
- mybatis:Mapper XML Files
- Mapper.xml映射文件
- Mapper.xml理解
- Mybatis-mapper-xml-基础
- mybatis mapper.xml详解
- mybatis and mapper.xml
- Mapper.xml映射文件
- 5 垃圾收集器与内存分配
- 今天聊聊虚拟化
- iOS UICollectionView布局错误
- android API和版本的对应关系
- 7 分析java堆
- mapper.xml
- 位运算
- 8 锁与并发
- 特征抽取-信息增益
- 二叉树的前序创建树以及中序后序非递归实现 以及节点个数,叶子节点个数第n层节点个数,深度
- android developer tiny share-20170603
- python之 python 起源、语言特点
- E
- 面向语义对比分析的词嵌入