1f836837f764adf9041a739ed02b295d0dde5e82.svn-base 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.synyi.edc.dao.IUserDao" >
  4. <resultMap id="BaseResultMap" type="com.synyi.edc.pojo.User" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="user_name" property="userName" jdbcType="VARCHAR" />
  7. <result column="password" property="password" jdbcType="VARCHAR" />
  8. <result column="age" property="age" jdbcType="INTEGER" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. id, user_name, password, age
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from user_t
  17. where id = #{id,jdbcType=INTEGER}
  18. </select>
  19. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  20. delete from user_t
  21. where id = #{id,jdbcType=INTEGER}
  22. </delete>
  23. <insert id="insert" parameterType="com.synyi.edc.pojo.User" >
  24. insert into user_t (id, user_name, password,
  25. age)
  26. values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  27. #{age,jdbcType=INTEGER})
  28. </insert>
  29. <insert id="insertSelective" parameterType="com.synyi.edc.pojo.User" >
  30. insert into user_t
  31. <trim prefix="(" suffix=")" suffixOverrides="," >
  32. <if test="id != null" >
  33. id,
  34. </if>
  35. <if test="userName != null" >
  36. user_name,
  37. </if>
  38. <if test="password != null" >
  39. password,
  40. </if>
  41. <if test="age != null" >
  42. age,
  43. </if>
  44. </trim>
  45. <trim prefix="values (" suffix=")" suffixOverrides="," >
  46. <if test="id != null" >
  47. #{id,jdbcType=INTEGER},
  48. </if>
  49. <if test="userName != null" >
  50. #{userName,jdbcType=VARCHAR},
  51. </if>
  52. <if test="password != null" >
  53. #{password,jdbcType=VARCHAR},
  54. </if>
  55. <if test="age != null" >
  56. #{age,jdbcType=INTEGER},
  57. </if>
  58. </trim>
  59. </insert>
  60. <update id="updateByPrimaryKeySelective" parameterType="com.synyi.edc.pojo.User" >
  61. update user_t
  62. <set >
  63. <if test="userName != null" >
  64. user_name = #{userName,jdbcType=VARCHAR},
  65. </if>
  66. <if test="password != null" >
  67. password = #{password,jdbcType=VARCHAR},
  68. </if>
  69. <if test="age != null" >
  70. age = #{age,jdbcType=INTEGER},
  71. </if>
  72. </set>
  73. where id = #{id,jdbcType=INTEGER}
  74. </update>
  75. <update id="updateByPrimaryKey" parameterType="com.synyi.edc.pojo.User" >
  76. update user_t
  77. set user_name = #{userName,jdbcType=VARCHAR},
  78. password = #{password,jdbcType=VARCHAR},
  79. age = #{age,jdbcType=INTEGER}
  80. where id = #{id,jdbcType=INTEGER}
  81. </update>
  82. </mapper>