placeOrderMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. <!-- 命名,每一个映射对象不一样
  4. namespace:必须与对应的接口全类名一致
  5. -->
  6. <mapper namespace="com.iamberry.wechat.service.mapper.PlaceOrderMapper">
  7. <sql id="orderAllField">
  8. t.PLACE_ORDERID id ,
  9. t.PLACE_INFO_ID placeInfoId ,
  10. t.PLACE_PRODUCT_ID productId,
  11. t.PLACE_PRODUCT_NUMBER productNumber,
  12. t.PLACE_OPENID openid,
  13. t.PLACE_YET_AMOUNT yetAmount,
  14. t.PLACE_AMOUNT amount,
  15. t.PLACE_POST_NUM postNum,
  16. t.PLACE_POST_FIRM postFirm ,
  17. t.PLACE_STATUS status,
  18. t.PLACE_SEND_DATE sendDate,
  19. t.PLACE_ADDRESS_INFO address,
  20. t.PLACE_POSTCODE postCode,
  21. t.PLACE_CONTACT_TEL tel,
  22. t.PLACE_CONTACT_NAME contactName,
  23. t.PLACE_CREATE_DATE createDate,
  24. t.PLACE_ADMIN_REMARK remark
  25. </sql>
  26. <select id="getOnePlaceOrder" parameterType="string" resultType="PlaceOrder">
  27. SELECT
  28. <include refid="orderAllField"/>,p.product_name productName
  29. FROM tb_iamberry_place_order t
  30. left join tb_iamberry_product_info p
  31. on t.place_product_id=p.product_id
  32. WHERE t.PLACE_ORDERID = #{appid}
  33. </select>
  34. <select id="selectAll" resultType="PlaceOrder" parameterType="PlaceOrder">
  35. select
  36. <include refid="orderAllField"/>
  37. from tb_iamberry_place_order t
  38. <where>
  39. <if test="productId!=null and productId!=''" >
  40. t.PLACE_PRODUCT_ID=#{productId}
  41. </if>
  42. <if test="id!=null and id!=''" >
  43. and t.PLACE_ORDERID=#{id}
  44. </if>
  45. <if test="status!=null and status!=''" >
  46. and t.PLACE_STATUS=#{status}
  47. </if>
  48. <if test="openid!=null and openid!=''" >
  49. and t.PLACE_OPENID=#{openid}
  50. </if>
  51. <if test="placeInfoId!=null and placeInfoId!=''" >
  52. and t.PLACE_INFO_ID=#{placeInfoId}
  53. </if>
  54. <if test="beginDate!=null and beginDate!=''">
  55. and t.PLACE_CREATE_DATE &gt; #{beginDate}
  56. </if>
  57. <if test="endDate!=null and endDate!=''">
  58. and t.PLACE_CREATE_DATE &lt; #{endDate}
  59. </if>
  60. </where>
  61. order by PLACE_CREATE_DATE DESC
  62. <if test="page!=null and page.recordBegin>0 and page.pageSize>0 ">
  63. limit ${page.recordBegin},${page.pageSize}
  64. </if>
  65. <if test="page!=null and page.recordBegin==0 and page.pageSize>0 ">
  66. limit ${page.pageSize}
  67. </if>
  68. </select>
  69. <select id="selectAllMore" resultType="PlaceOrder" parameterType="PlaceOrder">
  70. select
  71. <include refid="orderAllField"/>,p.product_name productName ,m.place_name drpName
  72. from TB_IAMBERRY_PLACE_ORDER t left join tb_iamberry_product_info p
  73. on t.place_product_id=p.product_id
  74. left join TB_IAMBERRY_PLACE_INFO m on t.place_openid=m.place_openid
  75. <where>
  76. <if test="productId!=null and productId!=''" >
  77. t.PLACE_PRODUCT_ID=#{productId}
  78. </if>
  79. <if test="id!=null and id!=''" >
  80. and t.PLACE_ORDERID=#{id}
  81. </if>
  82. <if test="status!=null and status!=''" >
  83. and t.PLACE_STATUS=#{status}
  84. </if>
  85. <if test="openid!=null and openid!=''" >
  86. and t.PLACE_OPENID=#{openid}
  87. </if>
  88. <if test="placeInfoId!=null and placeInfoId!=''" >
  89. and t.PLACE_INFO_ID=#{placeInfoId}
  90. </if>
  91. <if test="beginDate!=null and beginDate!=''">
  92. and t.PLACE_CREATE_DATE &gt; #{beginDate}
  93. </if>
  94. <if test="endDate!=null and endDate!=''">
  95. and t.PLACE_CREATE_DATE &lt; #{endDate}
  96. </if>
  97. </where>
  98. order by t.PLACE_CREATE_DATE DESC
  99. <if test="page!=null and page.recordBegin>0 and page.pageSize>0 ">
  100. limit ${page.recordBegin},${page.pageSize}
  101. </if>
  102. <if test="page!=null and page.recordBegin==0 and page.pageSize>0 ">
  103. limit ${page.pageSize}
  104. </if>
  105. </select>
  106. <select id="getAllCount" resultType="integer">
  107. select count(PLACE_ORDERID) from tb_iamberry_place_order
  108. <where>
  109. <if test="productId!=null and productId!=''" >
  110. PLACE_PRODUCT_ID=#{productId}
  111. </if>
  112. <if test="id!=null and id!=''" >
  113. and PLACE_ORDERID=#{id}
  114. </if>
  115. <if test="status!=null and status!=''" >
  116. and PLACE_STATUS=${status}
  117. </if>
  118. <if test="openid!=null and openid!=''" >
  119. and PLACE_OPENID=#{openid}
  120. </if>
  121. <if test="placeInfoId!=null and placeInfoId!=''" >
  122. and t.PLACE_INFO_ID=#{placeInfoId}
  123. </if>
  124. <if test="beginDate!=null and beginDate!=''">
  125. and PLACE_CREATE_DATE &gt; #{beginDate}
  126. </if>
  127. <if test="endDate!=null and endDate!=''">
  128. and PLACE_CREATE_DATE &lt; #{endDate}
  129. </if>
  130. </where>
  131. </select>
  132. <insert id="insert">
  133. insert into
  134. tb_iamberry_place_order(
  135. PLACE_ORDERID ,
  136. PLACE_INFO_ID ,
  137. PLACE_PRODUCT_ID ,
  138. PLACE_PRODUCT_NUMBER ,
  139. PLACE_OPENID ,
  140. PLACE_YET_AMOUNT ,
  141. PLACE_AMOUNT ,
  142. PLACE_POST_NUM ,
  143. PLACE_POST_FIRM ,
  144. PLACE_STATUS ,
  145. PLACE_SEND_DATE ,
  146. PLACE_ADDRESS_INFO ,
  147. PLACE_POSTCODE ,
  148. PLACE_CONTACT_TEL ,
  149. PLACE_CONTACT_NAME ,
  150. PLACE_CREATE_DATE ,
  151. PLACE_ADMIN_REMARK
  152. )
  153. values(
  154. #{id},
  155. #{placeInfoId},
  156. #{productId},
  157. #{productNumber},
  158. #{openid},
  159. #{yetAmount},
  160. #{amount},
  161. #{postNum},
  162. #{postFirm},
  163. #{status},
  164. #{sendDate},
  165. #{address},
  166. #{postCode},
  167. #{tel},
  168. #{contactName},
  169. #{createDate},
  170. #{remark}
  171. )
  172. </insert>
  173. <update id="update" >
  174. update tb_iamberry_place_order
  175. <set>
  176. <if test="productId!=null and productId!=''">
  177. PLACE_PRODUCT_ID =#{productId},
  178. </if>
  179. <if test="productNumber!=null and productNumber!=''">
  180. PLACE_PRODUCT_NUMBER =#{productNumber},
  181. </if>
  182. <if test="openid!=null and openid!=''">
  183. PLACE_OPENID =#{openid},
  184. </if>
  185. <if test="placeInfoId!=null and placeInfoId!=''" >
  186. and t.PLACE_INFO_ID=${placeInfoId}
  187. </if>
  188. <if test="yetAmount!=null and yetAmount!=''">
  189. PLACE_YET_AMOUNT =#{yetAmount},
  190. </if>
  191. <if test="amount!=null and amount!=''">
  192. PLACE_AMOUNT =#{amount},
  193. </if>
  194. <if test="postNum!=null and postNum!=''">
  195. PLACE_POST_NUM =#{postNum},
  196. </if>
  197. <if test="postFirm!=null and postFirm!=''">
  198. PLACE_POST_FIRM =#{postFirm},
  199. </if>
  200. <if test="status!=null and status!=''">
  201. PLACE_STATUS =#{status},
  202. </if>
  203. <if test="sendDate!=null and sendDate!=''">
  204. PLACE_SEND_DATE =#{sendDate},
  205. </if>
  206. <if test="postCode!=null and postCode!=''">
  207. PLACE_POSTCODE =#{postCode},
  208. </if>
  209. <if test="tel!=null and tel!=''">
  210. PLACE_CONTACT_TEL =#{tel},
  211. </if>
  212. <if test="contactName!=null and contactName!=''">
  213. PLACE_CONTACT_NAME =#{contactName},
  214. </if>
  215. <if test="remark!=null and remark!=''">
  216. PLACE_ADMIN_REMARK =#{remark},
  217. </if>
  218. </set>
  219. where PLACE_ORDERID = #{id}
  220. </update>
  221. <delete id="delete" parameterType="string">
  222. delete from tb_iamberry_place_order
  223. where WHERE PLACE_ORDERID = #{appid}
  224. </delete>
  225. </mapper>