|
@@ -0,0 +1,97 @@
|
|
|
|
+<?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="com.ygj.yuemum.dao.UserDao" >
|
|
|
|
+
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.ygj.yuemum.pojo.UserPO" >
|
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
|
+ <result column="name" property="name" jdbcType="VARCHAR" />
|
|
|
|
+ <result column="password" property="password" jdbcType="VARCHAR" />
|
|
|
|
+ <result column="age" property="age" jdbcType="INTEGER" />
|
|
|
|
+ <result column="phone" property="phone" jdbcType="VARCHAR" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
|
+ id, name, password, age, phone
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <!-- 得到所有的用户信息 -->
|
|
|
|
+ <select id="getAll" resultMap="BaseResultMap" >
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
|
+ from user
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 根据id查找某个用户信息 -->
|
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
|
+ from user
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 根据id删除某个用户信息 -->
|
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
|
+ delete from user
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <!-- 插入一条用户信息 -->
|
|
|
|
+ <insert id="insertSelective" parameterType="com.ygj.yuemum.pojo.UserPO" >
|
|
|
|
+ insert into user
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
|
+ <if test="id != null" >
|
|
|
|
+ id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null" >
|
|
|
|
+ name,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="password != null" >
|
|
|
|
+ password,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="age != null" >
|
|
|
|
+ age,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="phone != null" >
|
|
|
|
+ phone,
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
|
+ <if test="id != null" >
|
|
|
|
+ #{id,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null" >
|
|
|
|
+ #{name,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="password != null" >
|
|
|
|
+ #{password,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="age != null" >
|
|
|
|
+ #{age,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="phone != null" >
|
|
|
|
+ #{phone,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <!-- 根据id更新一条用户信息 -->
|
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.pojo.UserPO" >
|
|
|
|
+ update user
|
|
|
|
+ <set >
|
|
|
|
+ <if test="name != null" >
|
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="password != null" >
|
|
|
|
+ password = #{password,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="age != null" >
|
|
|
|
+ age = #{age,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="phone != null" >
|
|
|
|
+ phone = #{phone,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+</mapper>
|