Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

244 wiersze
8.8 KiB

  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.iformall.mapper.WxOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOrder">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="order_number" jdbcType="BIGINT" property="orderNumber" />
  7. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  8. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  9. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  10. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  11. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  12. <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
  13. <result column="payment" jdbcType="INTEGER" property="payment" />
  14. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
  15. <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
  16. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  17. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  18. <result column="detail" jdbcType="VARCHAR" property="detail" />
  19. </resultMap>
  20. <sql id="allColumns">
  21. `id`,`order_number`,`tenant_id`,`c_user_id`,`merchant_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail`
  22. </sql>
  23. <sql id="dynamicWhereConditions">
  24. where 1 = 1
  25. <if test=" null != id ">
  26. and `id` = #{id}
  27. </if>
  28. <if test=" null != orderNumber ">
  29. and `order_number` = #{orderNumber}
  30. </if>
  31. <if test=" null != tenantId ">
  32. and `tenant_id` = #{tenantId}
  33. </if>
  34. <if test=" null != cUserId ">
  35. and `c_user_id` = #{cUserId}
  36. </if>
  37. <if test=" null != merchantId ">
  38. and `merchant_id` = #{merchantId}
  39. </if>
  40. <if test=" null != bUserId ">
  41. and `b_user_id` = #{bUserId}
  42. </if>
  43. <if test=" null != couponId ">
  44. and `coupon_id` = #{couponId}
  45. </if>
  46. <if test=" null != paymentType ">
  47. and `payment_type` = #{paymentType}
  48. </if>
  49. <if test=" null != payment ">
  50. and `payment` = #{payment}
  51. </if>
  52. <if test=" null != paymentTime ">
  53. and `payment_time` = #{paymentTime}
  54. </if>
  55. <if test=" null != orderStatus ">
  56. and `order_status` = #{orderStatus}
  57. </if>
  58. <if test=" null != createDate ">
  59. and `create_date` = #{createDate}
  60. </if>
  61. <if test=" null != updateDate ">
  62. and `update_date` = #{updateDate}
  63. </if>
  64. <if test=" null != detail ">
  65. and `detail` like concat('%', #{detail},'%')
  66. </if>
  67. <if test=" null != ids ">
  68. and id in
  69. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  70. #{idItem}
  71. </foreach>
  72. </if>
  73. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  74. </sql>
  75. <select id="findList" parameterType="com.iformall.domain.po.WxOrder" resultMap="BaseResultMap">
  76. select <include refid="allColumns" /> from wx_order
  77. <include refid="dynamicWhereConditions" />
  78. </select>
  79. <select id="countList" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer">
  80. select count(*) from wx_order
  81. <include refid="dynamicWhereConditions" />
  82. </select>
  83. <select id="dayCountList" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer">
  84. select count(*) from wx_order
  85. where 1=1
  86. <if test=" null != tenantId ">
  87. and `tenant_id` = #{tenantId}
  88. </if>
  89. <if test=" null != cUserId ">
  90. and `c_user_id` = #{cUserId}
  91. </if>
  92. <if test=" null != couponId ">
  93. and `coupon_id` = #{couponId}
  94. </if>
  95. <if test=" null != orderStatus ">
  96. and `order_status` = #{orderStatus}
  97. </if>
  98. and `create_date` between date_sub(now(),interval 1 day) and now()
  99. </select>
  100. <select id="findListOfUnpaidOrderByDate" parameterType="map" resultMap="BaseResultMap">
  101. select <include refid="allColumns" /> from wx_order
  102. where order_status = '0'
  103. <if test="startDate != null">
  104. AND create_date &gt; #{startDate,jdbcType=TIMESTAMP}
  105. </if>
  106. <if test="endDate != null">
  107. AND create_date &lt; #{endDate,jdbcType=TIMESTAMP}
  108. </if>
  109. </select>
  110. <sql id="allCUserOrderListColumns">
  111. o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
  112. co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,
  113. m.name
  114. </sql>
  115. <sql id="allCUserOrderDetailColumns">
  116. o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
  117. co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark,
  118. m.img_url,m.name,m.link_phone,m.status,
  119. s.addr,s.shop_number,s.baidu_poi,
  120. mb.building_name,mf.floor_name,
  121. c.id as coupon_order_id,c.coupon_order_status
  122. </sql>
  123. <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCVo">
  124. <id column="id" jdbcType="BIGINT" property="id" />
  125. <result column="order_number" jdbcType="BIGINT" property="orderNumber" />
  126. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  127. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  128. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  129. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  130. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  131. <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
  132. <result column="payment" jdbcType="INTEGER" property="payment" />
  133. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
  134. <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
  135. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  136. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  137. <result column="type" jdbcType="INTEGER" property="type" />
  138. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  139. <result column="title" jdbcType="VARCHAR" property="title" />
  140. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  141. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  142. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  143. <result column="detail" jdbcType="VARCHAR" property="detail" />
  144. <result column="price" jdbcType="INTEGER" property="price" />
  145. <result column="remark" jdbcType="VARCHAR" property="remark" />
  146. <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
  147. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  148. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
  149. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  150. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
  151. <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
  152. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  153. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  154. <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
  155. <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
  156. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  157. </resultMap>
  158. <select id="findListOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
  159. select <include refid="allCUserOrderListColumns" />
  160. from wx_order o,wx_coupon co,wx_merchant m
  161. where o.coupon_id = co.id
  162. and co.merchant_id = m.id
  163. <if test="cUserId != null">
  164. and o.c_user_id = #{cUserId}
  165. </if>
  166. <if test="tenantId != null">
  167. and o.tenant_id = #{tenantId}
  168. </if>
  169. <if test="orderStatus != null">
  170. AND o.order_status = #{orderStatus}
  171. </if>
  172. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  173. </select>
  174. <select id="selectDetailOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
  175. select <include refid="allCUserOrderDetailColumns" />
  176. from (wx_order o,wx_coupon co,wx_merchant m)
  177. left join wx_coupon_order c on o.id = c.order_id
  178. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  179. left join wx_shop s on ms.shop_id = s.id
  180. left join wx_mall_building mb on s.building = mb.id
  181. left join wx_mall_floor mf on s.floor = mf.id
  182. where o.coupon_id = co.id
  183. and co.merchant_id = m.id
  184. <if test="cUserId != null">
  185. and o.c_user_id = #{cUserId}
  186. </if>
  187. <if test="tenantId != null">
  188. and o.tenant_id = #{tenantId}
  189. </if>
  190. <if test="id != null">
  191. and o.id = #{id}
  192. </if>
  193. </select>
  194. </mapper>