OrderItemMapper.xml 4.5 KB

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