OrderMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.OrderMapper">
  4. <resultMap id="BaseResultMap" type="com.how2java.tmall.pojo.Order">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="orderCode" jdbcType="VARCHAR" property="orderCode" />
  7. <result column="address" jdbcType="VARCHAR" property="address" />
  8. <result column="post" jdbcType="VARCHAR" property="post" />
  9. <result column="receiver" jdbcType="VARCHAR" property="receiver" />
  10. <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  11. <result column="userMessage" jdbcType="VARCHAR" property="userMessage" />
  12. <result column="createDate" jdbcType="TIMESTAMP" property="createDate" />
  13. <result column="payDate" jdbcType="TIMESTAMP" property="payDate" />
  14. <result column="deliveryDate" jdbcType="TIMESTAMP" property="deliveryDate" />
  15. <result column="confirmDate" jdbcType="TIMESTAMP" property="confirmDate" />
  16. <result column="uid" jdbcType="INTEGER" property="uid" />
  17. <result column="status" jdbcType="VARCHAR" property="status" />
  18. </resultMap>
  19. <sql id="Example_Where_Clause">
  20. <where>
  21. <foreach collection="oredCriteria" item="criteria" separator="or">
  22. <if test="criteria.valid">
  23. <trim prefix="(" prefixOverrides="and" suffix=")">
  24. <foreach collection="criteria.criteria" item="criterion">
  25. <choose>
  26. <when test="criterion.noValue">
  27. and ${criterion.condition}
  28. </when>
  29. <when test="criterion.singleValue">
  30. and ${criterion.condition} #{criterion.value}
  31. </when>
  32. <when test="criterion.betweenValue">
  33. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  34. </when>
  35. <when test="criterion.listValue">
  36. and ${criterion.condition}
  37. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  38. #{listItem}
  39. </foreach>
  40. </when>
  41. </choose>
  42. </foreach>
  43. </trim>
  44. </if>
  45. </foreach>
  46. </where>
  47. </sql>
  48. <sql id="Base_Column_List">
  49. id, orderCode, address, post, receiver, mobile, userMessage, createDate, payDate,
  50. deliveryDate, confirmDate, uid, status
  51. </sql>
  52. <select id="selectByExample" parameterType="com.how2java.tmall.pojo.OrderExample" resultMap="BaseResultMap">
  53. select
  54. <if test="distinct">
  55. distinct
  56. </if>
  57. 'false' as QUERYID,
  58. <include refid="Base_Column_List" />
  59. from order_
  60. <if test="_parameter != null">
  61. <include refid="Example_Where_Clause" />
  62. </if>
  63. <if test="orderByClause != null">
  64. order by ${orderByClause}
  65. </if>
  66. </select>
  67. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  68. select
  69. <include refid="Base_Column_List" />
  70. from order_
  71. where id = #{id,jdbcType=INTEGER}
  72. </select>
  73. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  74. delete from order_
  75. where id = #{id,jdbcType=INTEGER}
  76. </delete>
  77. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.Order" useGeneratedKeys="true">
  78. insert into order_ (orderCode, address, post,
  79. receiver, mobile, userMessage,
  80. createDate, payDate, deliveryDate,
  81. confirmDate, uid, status
  82. )
  83. values (#{orderCode,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{post,jdbcType=VARCHAR},
  84. #{receiver,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{userMessage,jdbcType=VARCHAR},
  85. #{createDate,jdbcType=TIMESTAMP}, #{payDate,jdbcType=TIMESTAMP}, #{deliveryDate,jdbcType=TIMESTAMP},
  86. #{confirmDate,jdbcType=TIMESTAMP}, #{uid,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}
  87. )
  88. </insert>
  89. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.Order" useGeneratedKeys="true">
  90. insert into order_
  91. <trim prefix="(" suffix=")" suffixOverrides=",">
  92. <if test="orderCode != null">
  93. orderCode,
  94. </if>
  95. <if test="address != null">
  96. address,
  97. </if>
  98. <if test="post != null">
  99. post,
  100. </if>
  101. <if test="receiver != null">
  102. receiver,
  103. </if>
  104. <if test="mobile != null">
  105. mobile,
  106. </if>
  107. <if test="userMessage != null">
  108. userMessage,
  109. </if>
  110. <if test="createDate != null">
  111. createDate,
  112. </if>
  113. <if test="payDate != null">
  114. payDate,
  115. </if>
  116. <if test="deliveryDate != null">
  117. deliveryDate,
  118. </if>
  119. <if test="confirmDate != null">
  120. confirmDate,
  121. </if>
  122. <if test="uid != null">
  123. uid,
  124. </if>
  125. <if test="status != null">
  126. status,
  127. </if>
  128. </trim>
  129. <trim prefix="values (" suffix=")" suffixOverrides=",">
  130. <if test="orderCode != null">
  131. #{orderCode,jdbcType=VARCHAR},
  132. </if>
  133. <if test="address != null">
  134. #{address,jdbcType=VARCHAR},
  135. </if>
  136. <if test="post != null">
  137. #{post,jdbcType=VARCHAR},
  138. </if>
  139. <if test="receiver != null">
  140. #{receiver,jdbcType=VARCHAR},
  141. </if>
  142. <if test="mobile != null">
  143. #{mobile,jdbcType=VARCHAR},
  144. </if>
  145. <if test="userMessage != null">
  146. #{userMessage,jdbcType=VARCHAR},
  147. </if>
  148. <if test="createDate != null">
  149. #{createDate,jdbcType=TIMESTAMP},
  150. </if>
  151. <if test="payDate != null">
  152. #{payDate,jdbcType=TIMESTAMP},
  153. </if>
  154. <if test="deliveryDate != null">
  155. #{deliveryDate,jdbcType=TIMESTAMP},
  156. </if>
  157. <if test="confirmDate != null">
  158. #{confirmDate,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="uid != null">
  161. #{uid,jdbcType=INTEGER},
  162. </if>
  163. <if test="status != null">
  164. #{status,jdbcType=VARCHAR},
  165. </if>
  166. </trim>
  167. </insert>
  168. <update id="updateByPrimaryKeySelective" parameterType="com.how2java.tmall.pojo.Order">
  169. update order_
  170. <set>
  171. <if test="orderCode != null">
  172. orderCode = #{orderCode,jdbcType=VARCHAR},
  173. </if>
  174. <if test="address != null">
  175. address = #{address,jdbcType=VARCHAR},
  176. </if>
  177. <if test="post != null">
  178. post = #{post,jdbcType=VARCHAR},
  179. </if>
  180. <if test="receiver != null">
  181. receiver = #{receiver,jdbcType=VARCHAR},
  182. </if>
  183. <if test="mobile != null">
  184. mobile = #{mobile,jdbcType=VARCHAR},
  185. </if>
  186. <if test="userMessage != null">
  187. userMessage = #{userMessage,jdbcType=VARCHAR},
  188. </if>
  189. <if test="createDate != null">
  190. createDate = #{createDate,jdbcType=TIMESTAMP},
  191. </if>
  192. <if test="payDate != null">
  193. payDate = #{payDate,jdbcType=TIMESTAMP},
  194. </if>
  195. <if test="deliveryDate != null">
  196. deliveryDate = #{deliveryDate,jdbcType=TIMESTAMP},
  197. </if>
  198. <if test="confirmDate != null">
  199. confirmDate = #{confirmDate,jdbcType=TIMESTAMP},
  200. </if>
  201. <if test="uid != null">
  202. uid = #{uid,jdbcType=INTEGER},
  203. </if>
  204. <if test="status != null">
  205. status = #{status,jdbcType=VARCHAR},
  206. </if>
  207. </set>
  208. where id = #{id,jdbcType=INTEGER}
  209. </update>
  210. <update id="updateByPrimaryKey" parameterType="com.how2java.tmall.pojo.Order">
  211. update order_
  212. set orderCode = #{orderCode,jdbcType=VARCHAR},
  213. address = #{address,jdbcType=VARCHAR},
  214. post = #{post,jdbcType=VARCHAR},
  215. receiver = #{receiver,jdbcType=VARCHAR},
  216. mobile = #{mobile,jdbcType=VARCHAR},
  217. userMessage = #{userMessage,jdbcType=VARCHAR},
  218. createDate = #{createDate,jdbcType=TIMESTAMP},
  219. payDate = #{payDate,jdbcType=TIMESTAMP},
  220. deliveryDate = #{deliveryDate,jdbcType=TIMESTAMP},
  221. confirmDate = #{confirmDate,jdbcType=TIMESTAMP},
  222. uid = #{uid,jdbcType=INTEGER},
  223. status = #{status,jdbcType=VARCHAR}
  224. where id = #{id,jdbcType=INTEGER}
  225. </update>
  226. </mapper>