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.
 
 
 
 
 

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