HouseOrderMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.template.mapper.HouseOrderMapper">
  4. <select id="pageList" resultType="com.template.model.vo.HouseOrderPageListVo">
  5. SELECT
  6. ho.order_number as orderNumber,
  7. ho.live_time as liveTime,
  8. ho.leave_time as leaveTime,
  9. ho.reserve_name as reserveName,
  10. ho.live_name as liveName,
  11. ho.reserve_phone as phone,
  12. h.room_name as houseName,
  13. hn.room_number as houseNumber,
  14. ho.pay_price as orderPrice,
  15. ho.pay_type as payType,
  16. ho.order_channel as payChannelType,
  17. ho.order_status as orderStart,
  18. ho.pay_time as payTime,
  19. ho.refund_time as refundTime,
  20. ho.cancel_time as cancelTime,
  21. h.id as houseId,
  22. hn.id as houserNumberId
  23. FROM
  24. `house_order` ho
  25. LEFT JOIN house_number hn ON hn.id = ho.house_number_id
  26. AND hn.deleted = 0
  27. LEFT JOIN house h ON h.id = hn.house_id
  28. AND hn.deleted = 0
  29. <where>
  30. ho.deleted=0
  31. <if test="orderStatus != null and orderStatus != ''">
  32. AND ho.order_status = #{orderStatus}
  33. </if>
  34. <if test="houseType != null and houseType != ''">
  35. AND h.room_type = #{houseType}
  36. </if>
  37. <if test="keyWord != null and keyWord != ''">
  38. AND (ho.reserve_name LIKE '%' #{keyWord} '%' or ho.live_name LIKE '%' #{keyWord} '%' )
  39. </if>
  40. <if test="payPriceStartTime != null and payPriceStartTime != '' and payPriceEndTime != null and payPriceEndTime != '' ">
  41. AND #{payPriceEndTime} >= ho.pay_time
  42. AND ho.pay_time >= #{payPriceStartTime}
  43. </if>
  44. <if test="refundStartTime != null and refundStartTime != '' and refundEndTime != null and refundEndTime != '' ">
  45. AND ho.refund_time >= #{refundStartTime}
  46. AND #{refundEndTime} >= ho.refund_time
  47. </if>
  48. <if test="cancelStartTime != null and cancelStartTime != '' and cancelEndTime != null and cancelEndTime != '' ">
  49. AND ho.cancel_time >= #{cancelStartTime}
  50. AND #{cancelEndTime} >= ho.cancel_time
  51. </if>
  52. <if test="liveStartTime != null and liveStartTime != '' and liveEndTime != null and liveEndTime != '' ">
  53. AND #{liveEndTime} >= ho.live_time
  54. AND ho.live_time >= #{liveStartTime}
  55. </if>
  56. <if test="leaveStartTime != null and leaveStartTime != '' and leaveEndTime != null and leaveEndTime != '' ">
  57. AND #{leaveEndTime} >= ho.leave_time
  58. AND ho.leave_time >= #{leaveStartTime}
  59. </if>
  60. </where>
  61. ORDER BY
  62. ho.create_time DESC
  63. </select>
  64. <select id="queryExport" resultType="com.template.model.vo.QueryExportVo">
  65. SELECT
  66. ho.order_number as orderNumber,
  67. ho.live_time as liveTime,
  68. ho.leave_time as leaveTime,
  69. ho.reserve_name as reserveName,
  70. ho.live_name as liveName,
  71. ho.reserve_phone as phone,
  72. h.room_name as houseName,
  73. hn.room_number as houseNumber,
  74. ho.pay_price as orderPrice,
  75. ho.pay_type as payType,
  76. ho.order_channel as payChannelType,
  77. ho.order_status as orderStart,
  78. ho.pay_time as payTime,
  79. ho.refund_time as refundTime,
  80. ho.cancel_time as cancelTime
  81. FROM
  82. `house_order` ho
  83. LEFT JOIN house_number hn ON hn.id = ho.house_number_id
  84. AND hn.deleted = 0
  85. LEFT JOIN house h ON h.id = hn.house_id
  86. AND hn.deleted = 0
  87. <where>
  88. ho.deleted=0
  89. <if test="orderStatus != null and orderStatus != ''">
  90. AND ho.order_status = #{orderStatus}
  91. </if>
  92. <if test="houseType != null and houseType != ''">
  93. AND h.room_type = #{houseType}
  94. </if>
  95. <if test="keyWord != null and keyWord != ''">
  96. AND (ho.reserve_name LIKE '%' #{keyWord} '%' or ho.live_name LIKE '%' #{keyWord} '%' )
  97. </if>
  98. <if test="payPriceStartTime != null and payPriceStartTime != '' and payPriceEndTime != null and payPriceEndTime != '' ">
  99. AND #{payPriceEndTime} >= ho.pay_time
  100. AND ho.pay_time >= #{payPriceStartTime}
  101. </if>
  102. <if test="refundStartTime != null and refundStartTime != '' and refundEndTime != null and refundEndTime != '' ">
  103. AND ho.refund_time >= #{refundStartTime}
  104. AND #{refundEndTime} >= ho.refund_time
  105. </if>
  106. <if test="cancelStartTime != null and cancelStartTime != '' and cancelEndTime != null and cancelEndTime != '' ">
  107. AND ho.cancel_time >= #{cancelStartTime}
  108. AND #{cancelEndTime} >= ho.cancel_time
  109. </if>
  110. <if test="liveStartTime != null and liveStartTime != '' and liveEndTime != null and liveEndTime != '' ">
  111. AND #{liveEndTime} >= ho.live_time
  112. AND ho.live_time >= #{liveStartTime}
  113. </if>
  114. <if test="leaveStartTime != null and leaveStartTime != '' and leaveEndTime != null and leaveEndTime != '' ">
  115. AND #{leaveEndTime} >= ho.leave_time
  116. AND ho.leave_time >= #{leaveStartTime}
  117. </if>
  118. </where>
  119. ORDER BY
  120. ho.create_time DESC
  121. </select>
  122. </mapper>