mapper.xml

前端之家收集整理的这篇文章主要介绍了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="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,description) values (#{id,jdbcType=INTEGER},#{username,jdbcType=VARCHAR},#{password,#{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,</if> <if test="username != null" > #{username,</if> <if test="password != null" > #{password,</if> <if test="description != null" > #{description,</if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="cn.emay.emas.entity.Usr" > update usr <set > <if test="username != null" > username = #{username,</if> <if test="password != null" > password = #{password,</if> <if test="description != null" > description = #{description,</if> </set> where id = #{id,jdbcType=INTEGER} </update> <update id="updateByPrimaryKey" parameterType="cn.emay.emas.entity.Usr" > update usr set username = #{username,password = #{password,description = #{description,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} </update> </mapper>

猜你在找的XML相关文章