You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

304 lines
12 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.iformall.mapper.WxLegionActivityOrderMapper">
  6. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityOrder">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  9. <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
  10. <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
  11. <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
  12. <result property="orderMoney" column="order_money" jdbcType="DECIMAL"/>
  13. <result property="cusId" column="cus_id" jdbcType="BIGINT"/>
  14. <result property="cusName" column="cus_name" jdbcType="VARCHAR"/>
  15. <result property="cusAddress" column="cus_address" jdbcType="VARCHAR"/>
  16. <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/>
  17. <result property="legionId" column="legion_id" jdbcType="BIGINT"/>
  18. <result property="unionId" column="union_id" jdbcType="BIGINT"/>
  19. <result property="orderType" column="order_type" jdbcType="SMALLINT"/>
  20. <result property="createBy" column="create_by" jdbcType="BIGINT"/>
  21. <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
  22. <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
  23. <result property="auditRemark" column="audit_remark" jdbcType="VARCHAR"/>
  24. <result property="auditStatus" column="audit_status" jdbcType="INTEGER"/>
  25. <result property="auditBy" column="audit_by" jdbcType="BIGINT"/>
  26. <result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
  27. </resultMap>
  28. <sql id="allColumns">
  29. id,tenant_id,parent_tenant_id,
  30. activity_id,order_no,order_money,
  31. cus_id,cus_name,cus_address,
  32. merchant_id,legion_id,union_id,
  33. order_type,create_by,create_date,
  34. update_date,audit_remark,audit_status,
  35. audit_by,audit_time
  36. </sql>
  37. <sql id="dynamicWhereConditions">
  38. where 1 = 1
  39. <if test=" null != id ">
  40. and `id` = #{id}
  41. </if>
  42. <if test=" null != tenantId and '' != tenantId">
  43. and `tenant_id` = #{tenantId}
  44. </if>
  45. <if test=" null != parentTenantId and '' != parentTenantId">
  46. and `parent_tenant_id` = #{parentTenantId}
  47. </if>
  48. <if test=" null != activityId ">
  49. and `activity_id` = #{activityId}
  50. </if>
  51. <if test=" null != orderNo and orderNo != '' ">
  52. and `order_no` like concat('%', #{orderNo},'%')
  53. </if>
  54. <if test=" null != cusId">
  55. and `cus_id` = #{cusId}
  56. </if>
  57. <if test=" null != cusName and cusName != '' ">
  58. and `cus_name` like concat('%', #{cusName},'%')
  59. </if>
  60. <if test=" null != merchantId ">
  61. and `merchant_id` = #{merchantId}
  62. </if>
  63. <if test=" null != legionId ">
  64. and `legion_id` = #{legionId}
  65. </if>
  66. <if test=" null != unionId ">
  67. and `union_id` = #{unionId}
  68. </if>
  69. <if test=" null != orderType ">
  70. and `order_type` = #{orderType}
  71. </if>
  72. <if test=" null != createDateBegin">
  73. and `create_date` &gt;= #{createDateBegin}
  74. </if>
  75. <if test=" null != createDateEnd">
  76. and `create_date` &lt;= #{createDateEnd}
  77. </if>
  78. <if test=" null != auditTimeBegin">
  79. and `audit_time` &gt;= #{auditTimeBegin}
  80. </if>
  81. <if test=" null != auditTimeEnd">
  82. and `audit_time` &lt;= #{auditTimeEnd}
  83. </if>
  84. <if test=" null != auditStatus ">
  85. and `audit_status` = #{auditStatus}
  86. </if>
  87. <if test=" null != orderTypeList ">
  88. and order_type in
  89. <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")">
  90. #{otyItem}
  91. </foreach>
  92. </if>
  93. <if test=" null != cusIdList ">
  94. and cus_id in
  95. <foreach collection="cusIdList" index="index" item="cidItem" open="(" separator="," close=")">
  96. #{cidItem}
  97. </foreach>
  98. </if>
  99. <if test=" null != merchantIdList ">
  100. and merchant_id in
  101. <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
  102. #{midItem}
  103. </foreach>
  104. </if>
  105. <if test=" null != ids ">
  106. and id in
  107. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  108. #{idItem}
  109. </foreach>
  110. </if>
  111. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  112. </sql>
  113. <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultMap="BaseResultMap">
  114. select <include refid="allColumns" /> from wx_legion_activity_order
  115. <include refid="dynamicWhereConditions" />
  116. </select>
  117. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  118. select <include refid="allColumns" /> from wx_legion_activity_order where id = #{id} and tenant_id=#{tenantId}
  119. </select>
  120. <update id="updateAuditStatus" parameterType="com.iformall.domain.po.WxLegionActivityOrder">
  121. update wx_legion_activity_order
  122. set `audit_status` = #{auditStatus},
  123. <if test=" null != auditRemark and '' != auditRemark">
  124. `audit_remark` = #{auditRemark},
  125. </if>
  126. <if test=" null != auditTime">
  127. `audit_time` = #{auditTime},
  128. </if>
  129. <if test=" null != auditBy">
  130. `audit_by` = #{auditBy},
  131. </if>
  132. `update_date` = #{updateDate}
  133. where 1 = 1
  134. <if test=" null != id ">
  135. and `id` = #{id}
  136. </if>
  137. <if test=" null != tenantId and '' != tenantId">
  138. and `tenant_id` = #{tenantId}
  139. </if>
  140. <if test=" null != parentTenantId and '' != parentTenantId">
  141. and `parent_tenant_id` = #{parentTenantId}
  142. </if>
  143. <if test=" null != activityId ">
  144. and `activity_id` = #{activityId}
  145. </if>
  146. <if test=" null != merchantIdList ">
  147. and merchant_id in
  148. <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
  149. #{midItem}
  150. </foreach>
  151. </if>
  152. </update>
  153. <select id="auditStatusStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderStatistics">
  154. SELECT audit_status as 'auditStatus',
  155. count(1) as 'count'
  156. FROM wx_legion_activity_order
  157. where 1 = 1
  158. <if test=" null != tenantId and '' != tenantId">
  159. and `tenant_id` = #{tenantId}
  160. </if>
  161. <if test=" null != parentTenantId and '' != parentTenantId">
  162. and `parent_tenant_id` = #{parentTenantId}
  163. </if>
  164. <if test=" null != activityId ">
  165. and `activity_id` = #{activityId}
  166. </if>
  167. <if test=" null != legionId ">
  168. and `legion_id` = #{legionId}
  169. </if>
  170. <if test=" null != merchantId ">
  171. and `merchant_id` = #{merchantId}
  172. </if>
  173. <if test=" null != createDateBegin">
  174. and `create_date` &gt;= #{createDateBegin}
  175. </if>
  176. <if test=" null != createDateEnd">
  177. and `create_date` &lt;= #{createDateEnd}
  178. </if>
  179. <if test=" null != auditStatus ">
  180. and `audit_status` = #{auditStatus}
  181. </if>
  182. GROUP BY audit_status
  183. </select>
  184. <select id="orderTypeStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics">
  185. SELECT order_type as 'orderType',
  186. count(1) as 'count'
  187. FROM wx_legion_activity_order
  188. where 1 = 1
  189. <if test=" null != tenantId and '' != tenantId">
  190. and `tenant_id` = #{tenantId}
  191. </if>
  192. <if test=" null != parentTenantId and '' != parentTenantId">
  193. and `parent_tenant_id` = #{parentTenantId}
  194. </if>
  195. <if test=" null != activityId ">
  196. and `activity_id` = #{activityId}
  197. </if>
  198. <if test=" null != legionId ">
  199. and `legion_id` = #{legionId}
  200. </if>
  201. <if test=" null != merchantId ">
  202. and `merchant_id` = #{merchantId}
  203. </if>
  204. <if test=" null != auditStatus ">
  205. and `audit_status` = #{auditStatus}
  206. </if>
  207. GROUP BY order_type
  208. </select>
  209. <select id="merchantStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics">
  210. SELECT merchant_id as 'merchantId',
  211. order_type as 'orderType',
  212. count(1) as 'count'
  213. FROM wx_legion_activity_order
  214. where 1 = 1
  215. <if test=" null != tenantId and '' != tenantId">
  216. and `tenant_id` = #{tenantId}
  217. </if>
  218. <if test=" null != parentTenantId and '' != parentTenantId">
  219. and `parent_tenant_id` = #{parentTenantId}
  220. </if>
  221. <if test=" null != activityId ">
  222. and `activity_id` = #{activityId}
  223. </if>
  224. <if test=" null != legionId ">
  225. and `legion_id` = #{legionId}
  226. </if>
  227. <if test=" null != merchantId ">
  228. and `merchant_id` = #{merchantId}
  229. </if>
  230. <if test=" null != auditStatus ">
  231. and `audit_status` = #{auditStatus}
  232. </if>
  233. GROUP BY merchant_id,order_type
  234. </select>
  235. <select id="findOrderUser" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivitySellOrder">
  236. SELECT o.id as 'orderId',
  237. o.order_no as 'orderNo',
  238. o.order_money as 'orderMoney',
  239. o.merchant_id as 'orderMerchantId',
  240. o.legion_id as 'orderLegionId',
  241. o.union_id as 'orderUnionId',
  242. o.order_type as 'orderType',
  243. o.create_date as 'orderCreateDate',
  244. u.id as 'cusId',
  245. u.phone as 'cusPhone',
  246. u.vip_num as 'cusVipNum',
  247. u.merchant_id as 'cusMerchantId',
  248. u.legion_id as 'cusLegionId',
  249. u.union_id as 'cusUnionId',
  250. u.create_date as 'cusCreateDate'
  251. FROM wx_legion_activity_order o
  252. left join wx_legion_activity_user u on u.id = o.cus_id
  253. where 1 = 1
  254. <if test=" null != tenantId and '' != tenantId">
  255. and o.`tenant_id` = #{tenantId}
  256. </if>
  257. <if test=" null != parentTenantId and '' != parentTenantId">
  258. and o.`parent_tenant_id` = #{parentTenantId}
  259. </if>
  260. <if test=" null != activityId ">
  261. and o.`activity_id` = #{activityId}
  262. </if>
  263. <if test=" null != auditStatus ">
  264. and o.`audit_status` = #{auditStatus}
  265. </if>
  266. <if test=" null != orderType ">
  267. and o.`order_type` = #{orderType}
  268. </if>
  269. <if test=" null != orderTypeList ">
  270. and o.order_type in
  271. <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")">
  272. #{otyItem}
  273. </foreach>
  274. </if>
  275. </select>
  276. </mapper>