MtOrderMapper.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.fuint.repository.mapper.MtOrderMapper">
  4. <select id="getOrderCount" resultType="java.math.BigDecimal">
  5. select count(*) from mt_order t where t.STATUS not in('C', 'G', 'H')
  6. <if test="merchantId != null and merchantId > 0">
  7. AND t.MERCHANT_ID = #{merchantId}
  8. </if>
  9. </select>
  10. <select id="getStoreOrderCount" resultType="java.math.BigDecimal">
  11. select count(*) from mt_order t where t.STORE_ID = #{storeId} and t.STATUS not in('C', 'G', 'H')
  12. </select>
  13. <select id="getOrderCountByTime" resultType="java.math.BigDecimal">
  14. select count(0) from mt_order t where t.CREATE_TIME &gt;= #{beginTime} and t.CREATE_TIME &lt; #{endTime} and t.STATUS not in('C', 'G', 'H')
  15. <if test="merchantId != null and merchantId > 0">
  16. AND t.MERCHANT_ID = #{merchantId}
  17. </if>
  18. </select>
  19. <select id="getStoreOrderCountByTime" resultType="java.math.BigDecimal">
  20. select count(0) from mt_order t where t.STORE_ID = #{storeId} and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
  21. </select>
  22. <select id="findByOrderSn" resultType="com.fuint.repository.model.MtOrder">
  23. select * from mt_order o where o.ORDER_SN = #{orderSn}
  24. </select>
  25. <select id="getPayMoney" resultType="java.math.BigDecimal">
  26. SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  27. <if test="merchantId != null and merchantId > 0">
  28. AND t.MERCHANT_ID = #{merchantId}
  29. </if>
  30. </select>
  31. <select id="getPayMoneyByTime" resultType="java.math.BigDecimal">
  32. SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
  33. <if test="merchantId != null and merchantId > 0">
  34. AND t.MERCHANT_ID = #{merchantId}
  35. </if>
  36. </select>
  37. <select id="getStorePayMoneyByTime" resultType="java.math.BigDecimal">
  38. SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
  39. </select>
  40. <select id="getStorePayMoney" resultType="java.math.BigDecimal">
  41. SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  42. </select>
  43. <select id="getPayUserCount" resultType="java.lang.Integer">
  44. SELECT COUNT(DISTINCT t.USER_ID) as num FROM mt_order t where t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  45. <if test="merchantId != null and merchantId > 0">
  46. and t.MERCHANT_ID = #{merchantId}
  47. </if>
  48. </select>
  49. <select id="getStorePayUserCount" resultType="java.lang.Integer">
  50. SELECT COUNT(DISTINCT t.USER_ID) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  51. </select>
  52. <select id="getUserPayMoney" resultType="java.math.BigDecimal">
  53. SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.USER_ID = #{userId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  54. </select>
  55. <select id="getUserPayOrderCount" resultType="java.lang.Integer">
  56. SELECT COUNT(DISTINCT t.ID) as num FROM mt_order t where t.USER_ID = #{userId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
  57. </select>
  58. <select id="getTobeCommissionOrderList" resultType="com.fuint.repository.model.MtOrder">
  59. SELECT t.* FROM `mt_order` t WHERE t.PAY_TIME &lt;= #{dateTime} AND t.STATUS NOT IN('C', 'G', 'H') AND t.PAY_STATUS = 'B' AND t.COMMISSION_STATUS = 'A' ORDER BY t.ID DESC LIMIT 10
  60. </select>
  61. </mapper>