PropertyValueMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.how2java.tmall.mapper.PropertyValueMapper">
  4. <resultMap id="BaseResultMap" type="com.how2java.tmall.pojo.PropertyValue">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="pid" jdbcType="INTEGER" property="pid" />
  7. <result column="ptid" jdbcType="INTEGER" property="ptid" />
  8. <result column="value" jdbcType="VARCHAR" property="value" />
  9. </resultMap>
  10. <sql id="Example_Where_Clause">
  11. <where>
  12. <foreach collection="oredCriteria" item="criteria" separator="or">
  13. <if test="criteria.valid">
  14. <trim prefix="(" prefixOverrides="and" suffix=")">
  15. <foreach collection="criteria.criteria" item="criterion">
  16. <choose>
  17. <when test="criterion.noValue">
  18. and ${criterion.condition}
  19. </when>
  20. <when test="criterion.singleValue">
  21. and ${criterion.condition} #{criterion.value}
  22. </when>
  23. <when test="criterion.betweenValue">
  24. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  25. </when>
  26. <when test="criterion.listValue">
  27. and ${criterion.condition}
  28. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  29. #{listItem}
  30. </foreach>
  31. </when>
  32. </choose>
  33. </foreach>
  34. </trim>
  35. </if>
  36. </foreach>
  37. </where>
  38. </sql>
  39. <sql id="Base_Column_List">
  40. id, pid, ptid, value
  41. </sql>
  42. <select id="selectByExample" parameterType="com.how2java.tmall.pojo.PropertyValueExample" resultMap="BaseResultMap">
  43. select
  44. <if test="distinct">
  45. distinct
  46. </if>
  47. 'false' as QUERYID,
  48. <include refid="Base_Column_List" />
  49. from propertyvalue
  50. <if test="_parameter != null">
  51. <include refid="Example_Where_Clause" />
  52. </if>
  53. <if test="orderByClause != null">
  54. order by ${orderByClause}
  55. </if>
  56. </select>
  57. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  58. select
  59. <include refid="Base_Column_List" />
  60. from propertyvalue
  61. where id = #{id,jdbcType=INTEGER}
  62. </select>
  63. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  64. delete from propertyvalue
  65. where id = #{id,jdbcType=INTEGER}
  66. </delete>
  67. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.PropertyValue" useGeneratedKeys="true">
  68. insert into propertyvalue (pid, ptid, value
  69. )
  70. values (#{pid,jdbcType=INTEGER}, #{ptid,jdbcType=INTEGER}, #{value,jdbcType=VARCHAR}
  71. )
  72. </insert>
  73. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.PropertyValue" useGeneratedKeys="true">
  74. insert into propertyvalue
  75. <trim prefix="(" suffix=")" suffixOverrides=",">
  76. <if test="pid != null">
  77. pid,
  78. </if>
  79. <if test="ptid != null">
  80. ptid,
  81. </if>
  82. <if test="value != null">
  83. value,
  84. </if>
  85. </trim>
  86. <trim prefix="values (" suffix=")" suffixOverrides=",">
  87. <if test="pid != null">
  88. #{pid,jdbcType=INTEGER},
  89. </if>
  90. <if test="ptid != null">
  91. #{ptid,jdbcType=INTEGER},
  92. </if>
  93. <if test="value != null">
  94. #{value,jdbcType=VARCHAR},
  95. </if>
  96. </trim>
  97. </insert>
  98. <update id="updateByPrimaryKeySelective" parameterType="com.how2java.tmall.pojo.PropertyValue">
  99. update propertyvalue
  100. <set>
  101. <if test="pid != null">
  102. pid = #{pid,jdbcType=INTEGER},
  103. </if>
  104. <if test="ptid != null">
  105. ptid = #{ptid,jdbcType=INTEGER},
  106. </if>
  107. <if test="value != null">
  108. value = #{value,jdbcType=VARCHAR},
  109. </if>
  110. </set>
  111. where id = #{id,jdbcType=INTEGER}
  112. </update>
  113. <update id="updateByPrimaryKey" parameterType="com.how2java.tmall.pojo.PropertyValue">
  114. update propertyvalue
  115. set pid = #{pid,jdbcType=INTEGER},
  116. ptid = #{ptid,jdbcType=INTEGER},
  117. value = #{value,jdbcType=VARCHAR}
  118. where id = #{id,jdbcType=INTEGER}
  119. </update>
  120. </mapper>