mapper.xml 淩亂°似流年 2022-06-15 12:44 145阅读 0赞 <?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>
还没有评论,来说两句吧...