GiftCardOrderMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.ylx.giftCard.mapper.GiftCardOrderMapper">
  6. <select id="selectAdminGiftCardOrderPage" resultType="com.ylx.giftCard.domain.vo.GiftCardOrderPageVO">
  7. SELECT
  8. gco.id,
  9. gco.order_no AS orderId,
  10. gco.order_no AS orderNo,
  11. gco.gift_card_name AS giftCardName,
  12. gco.pay_amount AS payAmount,
  13. gco.user_name AS userName,
  14. gco.user_phone AS userPhone,
  15. gco.create_time AS orderTime,
  16. gco.commission_amount AS commissionAmount,
  17. mt.te_phone AS merchantAccount,
  18. gco.merchant_name AS merchantName,
  19. gco.merchant_nick_name AS merchantNickName
  20. FROM gift_card_order gco
  21. LEFT JOIN ma_technician mt ON mt.id = gco.merchant_id
  22. <where>
  23. <if test="dto.userName != null and dto.userName != ''">
  24. AND gco.user_name LIKE CONCAT('%', #{dto.userName}, '%')
  25. </if>
  26. <if test="dto.merchantName != null and dto.merchantName != ''">
  27. AND gco.merchant_name LIKE CONCAT('%', #{dto.merchantName}, '%')
  28. </if>
  29. <if test="dto.startTime != null and dto.startTime != ''">
  30. AND gco.create_time &gt;= #{dto.startTime}
  31. </if>
  32. <if test="dto.endTime != null and dto.endTime != ''">
  33. AND gco.create_time &lt;= #{dto.endTime}
  34. </if>
  35. </where>
  36. ORDER BY
  37. gco.create_time DESC
  38. </select>
  39. <select id="selectAdminGiftCardOrderExportList" resultType="com.ylx.giftCard.domain.vo.GiftCardOrderExportVO">
  40. SELECT
  41. gco.id AS orderId,
  42. gco.gift_card_name AS giftCardName,
  43. gco.pay_amount AS payAmount,
  44. gco.user_name AS userName,
  45. gco.user_phone AS userPhone,
  46. gco.create_time AS orderTime,
  47. gco.commission_amount AS commissionAmount,
  48. mt.te_phone AS merchantAccount,
  49. gco.merchant_name AS merchantName,
  50. gco.merchant_nick_name AS merchantNickName
  51. FROM gift_card_order gco
  52. LEFT JOIN ma_technician mt ON mt.id = gco.merchant_id
  53. <where>
  54. <if test="dto.userName != null and dto.userName != ''">
  55. AND gco.user_name LIKE CONCAT('%', #{dto.userName}, '%')
  56. </if>
  57. <if test="dto.merchantName != null and dto.merchantName != ''">
  58. AND gco.merchant_name LIKE CONCAT('%', #{dto.merchantName}, '%')
  59. </if>
  60. <if test="dto.startTime != null and dto.startTime != ''">
  61. AND gco.create_time &gt;= #{dto.startTime}
  62. </if>
  63. <if test="dto.endTime != null and dto.endTime != ''">
  64. AND gco.create_time &lt;= #{dto.endTime}
  65. </if>
  66. </where>
  67. ORDER BY
  68. gco.create_time DESC
  69. </select>
  70. <select id="selectPcPurchaseShoppingFundsDetail" resultType="com.ylx.giftCard.domain.vo.UserShoppingFundsDetailItemVO">
  71. SELECT
  72. gco.order_no AS orderNo,
  73. gco.gift_card_name AS giftCardName,
  74. gco.pay_amount AS orderAmount,
  75. gco.create_time AS orderTime
  76. FROM gift_card_order gco
  77. <where>
  78. gco.user_id = #{dto.userId}
  79. AND gco.status = 1
  80. <if test="dto.startTime != null and dto.startTime != ''">
  81. AND gco.create_time &gt;= #{dto.startTime}
  82. </if>
  83. <if test="dto.endTime != null and dto.endTime != ''">
  84. AND gco.create_time &lt;= #{dto.endTime}
  85. </if>
  86. </where>
  87. ORDER BY
  88. gco.create_time DESC
  89. </select>
  90. <select id="selectPcPurchaseShoppingFundsSummary" resultType="com.ylx.giftCard.domain.vo.UserShoppingFundsSummaryVO">
  91. SELECT
  92. COALESCE(SUM(gco.pay_amount), 0) AS totalAmount,
  93. COUNT(1) AS totalCount
  94. FROM gift_card_order gco
  95. <where>
  96. gco.user_id = #{dto.userId}
  97. AND gco.status = 1
  98. <if test="dto.startTime != null and dto.startTime != ''">
  99. AND gco.create_time &gt;= #{dto.startTime}
  100. </if>
  101. <if test="dto.endTime != null and dto.endTime != ''">
  102. AND gco.create_time &lt;= #{dto.endTime}
  103. </if>
  104. </where>
  105. </select>
  106. </mapper>