后台服务
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

274 行
9.4 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.TtOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.tt.TtOrder">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  9. <result column="product_id" jdbcType="BIGINT" property="productId"/>
  10. <result column="product_title" jdbcType="VARCHAR" property="productTitle"/>
  11. <result column="product_pic" jdbcType="VARCHAR" property="productPic"/>
  12. <result column="product_sale_price" jdbcType="INTEGER" property="productSalePrice"/>
  13. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  14. <result column="type" jdbcType="TINYINT" property="type"/>
  15. <result column="way" jdbcType="TINYINT" property="way"/>
  16. <result column="payment_type" jdbcType="INTEGER" property="paymentType"/>
  17. <result column="payment" jdbcType="INTEGER" property="payment"/>
  18. <result column="payment_time" jdbcType="VARCHAR" property="paymentTime"/>
  19. <result column="order_status" jdbcType="INTEGER" property="orderStatus"/>
  20. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  21. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  22. <result column="is_recorded" jdbcType="INTEGER" property="isRecorded"/>
  23. <result column="recorded_date" jdbcType="TIMESTAMP" property="recordedDate"/>
  24. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  25. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  26. <result column="author" jdbcType="VARCHAR" property="author"/>
  27. <result column="author_pic" jdbcType="VARCHAR" property="authorPic"/>
  28. </resultMap>
  29. <sql id="allColumns">
  30. o.`id`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,o.`way`,o.`payment_type`,o.`payment`,
  31. o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`is_recorded`,o.`recorded_date`,
  32. u.`nick_name`,u.`phone`,
  33. o.`product_title`,o.`product_pic`,o.`product_sale_price`,
  34. m.`name` author,m.`img_url` author_pic
  35. </sql>
  36. <sql id="dynamicWhereConditions">
  37. where 1 = 1
  38. <if test=" null != id ">
  39. and o.`id` = #{id}
  40. </if>
  41. <if test=" null != tenantId and '' != tenantId">
  42. and o.`tenant_id` = #{tenantId}
  43. </if>
  44. <if test=" null != parentTenantId and '' != parentTenantId">
  45. and o.`parent_tenant_id` = #{parentTenantId}
  46. </if>
  47. <if test=" null != cUserId ">
  48. and o.`c_user_id` = #{cUserId}
  49. </if>
  50. <if test=" null != productId ">
  51. and o.`product_id` = #{productId}
  52. </if>
  53. <if test=" null != type ">
  54. and o.`type` = #{type}
  55. </if>
  56. <if test=" null != way ">
  57. and o.`way` = #{way}
  58. </if>
  59. <if test=" null != paymentType ">
  60. and o.`payment_type` = #{paymentType}
  61. </if>
  62. <if test="startdate != null">
  63. and o.`create_date` &gt;= #{startdate}
  64. </if>
  65. <if test="enddate != null">
  66. and o.`create_date` &lt;= #{enddate}
  67. </if>
  68. <if test=" null != orderStatus ">
  69. and o.`order_status` = #{orderStatus}
  70. </if>
  71. <if test=" null != isRecorded ">
  72. and o.`is_recorded` = #{isRecorded}
  73. </if>
  74. <if test=" null != nickName ">
  75. and u.`nick_name` like concat('%', #{nickName},'%')
  76. </if>
  77. <if test=" null != phone ">
  78. and u.`phone` like concat('%', #{phone},'%')
  79. </if>
  80. <if test=" null != productTitle ">
  81. and o.`product_title` like concat('%', #{productTitle},'%')
  82. </if>
  83. <if test=" null != merchantId ">
  84. and o.merchant_id = #{merchantId}
  85. </if>
  86. <if test=" null != author ">
  87. and m.`name` like concat('%', #{author},'%')
  88. </if>
  89. <if test=" null != statusS ">
  90. and o.`order_status` in
  91. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  92. #{sItem}
  93. </foreach>
  94. </if>
  95. <if test=" null != ids ">
  96. and o.`id` in
  97. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  98. #{idItem}
  99. </foreach>
  100. </if>
  101. order by o.`update_date` desc
  102. </sql>
  103. <select id="findList" parameterType="com.iformall.domain.po.tt.TtOrder" resultMap="BaseResultMap">
  104. select
  105. <include refid="allColumns"/>
  106. from tt_order o
  107. left join tt_c_user u on o.c_user_id = u.id
  108. left join wx_merchant m on o.merchant_id = m.id
  109. <include refid="dynamicWhereConditions"/>
  110. </select>
  111. <select id="findCList" parameterType="com.iformall.domain.po.tt.TtOrder" resultMap="BaseResultMap">
  112. select
  113. <include refid="allColumnsC"/>
  114. from tt_order o
  115. left join wx_merchant m on o.merchant_id = m.id
  116. <include refid="dynamicWhereConditionsC"/>
  117. </select>
  118. <sql id="allColumnsC">
  119. o.`id`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,o.`way`,o.`payment_type`,o.`payment`,
  120. o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,
  121. o.`product_title`,o.`product_pic`,o.`product_sale_price`,
  122. m.`name` author,m.`img_url` author_pic
  123. </sql>
  124. <sql id="dynamicWhereConditionsC">
  125. where 1 = 1
  126. <if test=" null != id ">
  127. and o.`id` = #{id}
  128. </if>
  129. <if test=" null != tenantId and '' != tenantId">
  130. and o.`tenant_id` = #{tenantId}
  131. </if>
  132. <if test=" null != parentTenantId and '' != parentTenantId">
  133. and o.`parent_tenant_id` = #{parentTenantId}
  134. </if>
  135. <if test=" null != cUserId ">
  136. and o.`c_user_id` = #{cUserId}
  137. </if>
  138. <if test=" null != productId ">
  139. and o.`product_id` = #{productId}
  140. </if>
  141. <if test=" null != productTitle ">
  142. and o.`product_title` like concat('%', #{productTitle},'%')
  143. </if>
  144. <if test=" null != type ">
  145. and o.`type` = #{type}
  146. </if>
  147. <if test=" null != way ">
  148. and o.`way` = #{way}
  149. </if>
  150. <if test=" null != paymentType ">
  151. and o.`payment_type` = #{paymentType}
  152. </if>
  153. <if test="startdate != null">
  154. and o.`create_date` &gt;= #{startdate}
  155. </if>
  156. <if test="enddate != null">
  157. and o.`create_date` &lt;= #{enddate}
  158. </if>
  159. <if test=" null != orderStatus ">
  160. and o.`order_status` = #{orderStatus}
  161. </if>
  162. <if test=" null != merchantId ">
  163. and o.merchant_id = #{merchantId}
  164. </if>
  165. <if test=" null != author ">
  166. and m.`name` like concat('%', #{author},'%')
  167. </if>
  168. <if test=" null != statusS ">
  169. and o.`order_status` in
  170. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  171. #{sItem}
  172. </foreach>
  173. </if>
  174. <if test=" null != ids ">
  175. and o.`id` in
  176. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  177. #{idItem}
  178. </foreach>
  179. </if>
  180. order by o.`update_date` desc
  181. </sql>
  182. <select id="findListCount" parameterType="com.iformall.domain.po.tt.TtOrder" resultType="Integer">
  183. select count(1)
  184. from tt_order
  185. where 1 = 1
  186. <if test=" null != tenantId and '' != tenantId">
  187. and `tenant_id` = #{tenantId}
  188. </if>
  189. <if test=" null != parentTenantId and '' != parentTenantId">
  190. and `parent_tenant_id` = #{parentTenantId}
  191. </if>
  192. <if test=" null != cUserId ">
  193. and `c_user_id` = #{cUserId}
  194. </if>
  195. <if test=" null != productId ">
  196. and `product_id` = #{productId}
  197. </if>
  198. <if test=" null != orderStatus ">
  199. and `order_status` = #{orderStatus}
  200. </if>
  201. <if test=" null != statusS ">
  202. and `order_status` in
  203. <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
  204. #{sItem}
  205. </foreach>
  206. </if>
  207. </select>
  208. <select id="findExpireIdList" parameterType="java.util.HashMap" resultType="com.iformall.domain.po.tt.TtOrder">
  209. select `id`,`tenant_id`,`parent_tenant_id`,order_status,create_date
  210. from tt_order
  211. where order_status=#{orderStatus} and create_date &lt;= #{beforeDate}
  212. </select>
  213. <select id="findBeforeIdList" parameterType="java.util.HashMap" resultType="Long">
  214. select id
  215. from tt_order
  216. where order_status=#{orderStatus} and create_date &lt;= #{beforeDate}
  217. <if test=" null != isRecorded ">
  218. and `is_recorded` = #{isRecorded}
  219. </if>
  220. </select>
  221. <update id="updateIsRecorded" parameterType="java.util.HashMap">
  222. update tt_order set `is_recorded` = #{isRecorded},recorded_date = now() where id = #{id}
  223. </update>
  224. </mapper>