Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

228 строки
8.2 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.simple.mapper.WxOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.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` like concat('%', #{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.simple.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.simple.domain.po.WxOrder" resultType="java.lang.Integer">
  80. select count(*) from wx_order
  81. <include refid="dynamicWhereConditions" />
  82. </select>
  83. <select id="findListOfUnpaidOrderByDate" parameterType="map" resultMap="BaseResultMap">
  84. select <include refid="allColumns" /> from wx_order
  85. where order_status = '0'
  86. <if test="startDate != null">
  87. AND create_date &gt; #{startDate,jdbcType=TIMESTAMP}
  88. </if>
  89. <if test="endDate != null">
  90. AND create_date &lt; #{endDate,jdbcType=TIMESTAMP}
  91. </if>
  92. </select>
  93. <sql id="allCUserOrderListColumns">
  94. 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,
  95. co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,
  96. m.name
  97. </sql>
  98. <sql id="allCUserOrderDetailColumns">
  99. 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,
  100. co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark,
  101. m.img_url,m.name,m.link_phone,m.status,
  102. s.addr,s.shop_number,s.baidu_poi,
  103. mb.building_name,mf.floor_name,
  104. c.id as coupon_order_id,c.coupon_order_status
  105. </sql>
  106. <resultMap id="CVoResultMap" type="com.simple.domain.vo.WxOrderCVo">
  107. <id column="id" jdbcType="BIGINT" property="id" />
  108. <result column="order_number" jdbcType="BIGINT" property="orderNumber" />
  109. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  110. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  111. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  112. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  113. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  114. <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
  115. <result column="payment" jdbcType="INTEGER" property="payment" />
  116. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
  117. <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
  118. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  119. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  120. <result column="type" jdbcType="INTEGER" property="type" />
  121. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  122. <result column="title" jdbcType="VARCHAR" property="title" />
  123. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  124. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  125. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  126. <result column="detail" jdbcType="VARCHAR" property="detail" />
  127. <result column="price" jdbcType="INTEGER" property="price" />
  128. <result column="remark" jdbcType="VARCHAR" property="remark" />
  129. <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
  130. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  131. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
  132. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  133. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
  134. <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
  135. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  136. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  137. <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
  138. <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
  139. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  140. </resultMap>
  141. <select id="findListOfCUser" parameterType="com.simple.domain.po.WxOrder" resultMap="CVoResultMap">
  142. select <include refid="allCUserOrderListColumns" />
  143. from wx_order o,wx_coupon co,wx_merchant m
  144. where o.coupon_id = co.id
  145. and co.merchant_id = m.id
  146. <if test="cUserId != null">
  147. and o.c_user_id = #{cUserId}
  148. </if>
  149. <if test="tenantId != null">
  150. and o.tenant_id = #{tenantId}
  151. </if>
  152. <if test="orderStatus != null">
  153. AND o.order_status = #{orderStatus}
  154. </if>
  155. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  156. </select>
  157. <select id="selectDetailOfCUser" parameterType="com.simple.domain.po.WxOrder" resultMap="CVoResultMap">
  158. select <include refid="allCUserOrderDetailColumns" />
  159. from (wx_order o,wx_coupon co,wx_merchant m)
  160. left join wx_coupon_order c on o.id = c.order_id
  161. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  162. left join wx_shop s on ms.shop_id = s.id
  163. left join wx_mall_building mb on s.building = mb.id
  164. left join wx_mall_floor mf on s.floor = mf.id
  165. where o.coupon_id = co.id
  166. and co.merchant_id = m.id
  167. <if test="cUserId != null">
  168. and o.c_user_id = #{cUserId}
  169. </if>
  170. <if test="tenantId != null">
  171. and o.tenant_id = #{tenantId}
  172. </if>
  173. <if test="id != null">
  174. and o.id = #{id}
  175. </if>
  176. </select>
  177. </mapper>