CardTransacOrderMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.crm.ucard.dao.mapper.CardTransacOrderMapper">
  4. <select id="countList" resultType="integer"
  5. parameterType="com.crm.rely.backend.core.entity.ucard.CardTransacOrderPageEntity">
  6. SELECT COUNT(*)
  7. FROM ucard_transac_order t
  8. LEFT JOIN ucard_card c ON t.card_no = c.card_no
  9. LEFT JOIN ucard_type b ON c.card_type_id = b.card_type_id
  10. LEFT JOIN ucard_type_config ut ON ut.card_type_id = b.card_type_id
  11. LEFT JOIN ucard_merchant_user uc ON c.unique_id = uc.unique_id
  12. <where>
  13. <if test="merchantId != null">
  14. and uc.`merchant_id` = #{merchantId}
  15. </if>
  16. <if test="cardNumber!=null and cardNumber!=''">
  17. and c.`card_number` like concat(#{cardNumber},'%')
  18. </if>
  19. <if test="currency!=null and currency!=''">
  20. and t.`currency` = #{currency}
  21. </if>
  22. <if test="type != null and type != ''">
  23. and t.`type` = #{type}
  24. </if>
  25. <if test="status!=null and status!=''">
  26. <choose>
  27. <when test="status == 'success'">
  28. and (t.`status` = 'success' or t.`status` = 'succeed')
  29. </when>
  30. <when test="status == 'fail'">
  31. and (t.`status` = 'fail' or t.`status` = 'failed')
  32. </when>
  33. <otherwise>
  34. and t.`status` = #{status}
  35. </otherwise>
  36. </choose>
  37. </if>
  38. <if test="beginDate != null and beginDate != '' and beginDate > 0">
  39. and t.settle_date <![CDATA[ >= ]]> #{beginDate}
  40. </if>
  41. <if test="endDate != null and endDate != '' and endDate > 0">
  42. and t.settle_date <![CDATA[ <= ]]> #{endDate}
  43. </if>
  44. <if test="cardType != null and cardType != ''">
  45. and b.`type` = #{type}
  46. </if>
  47. <if test="email!=null and email!=''">
  48. and uc.`email` like concat(#{email},'%')
  49. </if>
  50. <if test="mobile!=null and mobile!=''">
  51. and uc.`mobile` like concat(#{mobile},'%')
  52. </if>
  53. <if test="cId != null and cId > 0">
  54. and uc.`c_id` = #{cId}
  55. </if>
  56. </where>
  57. </select>
  58. <select id="pageList" resultType="com.crm.rely.backend.core.dto.ucard.CardTransacOrderDto"
  59. parameterType="com.crm.rely.backend.core.entity.ucard.CardTransacOrderPageEntity">
  60. SELECT t.*,
  61. b.`type` AS card_type,
  62. b.card_type_id,
  63. COALESCE(ut.card_name, b.card_name) as card_name,
  64. uc.c_id,uc.mobile,
  65. uc.email,
  66. uc.area_code,
  67. uc.last_name,
  68. uc.first_name,
  69. uc.`country` AS user_country,
  70. c.card_number AS card_number
  71. FROM ucard_transac_order t
  72. LEFT JOIN ucard_card c ON t.card_no = c.card_no
  73. LEFT JOIN ucard_type b ON c.card_type_id = b.card_type_id
  74. LEFT JOIN ucard_type_config ut ON ut.card_type_id = b.card_type_id
  75. LEFT JOIN ucard_merchant_user uc ON c.unique_id = uc.unique_id
  76. <where>
  77. <if test="merchantId != null">
  78. and uc.`merchant_id` = #{merchantId}
  79. </if>
  80. <if test="cardNumber!=null and cardNumber!=''">
  81. and c.`card_number` like concat(#{cardNumber},'%')
  82. </if>
  83. <if test="currency!=null and currency!=''">
  84. and t.`currency` = #{currency}
  85. </if>
  86. <if test="type != null and type != ''">
  87. and t.`type` = #{type}
  88. </if>
  89. <if test="status!=null and status!=''">
  90. <choose>
  91. <when test="status == 'success'">
  92. and (t.`status` = 'success' or t.`status` = 'succeed')
  93. </when>
  94. <when test="status == 'fail'">
  95. and (t.`status` = 'fail' or t.`status` = 'failed')
  96. </when>
  97. <otherwise>
  98. and t.`status` = #{status}
  99. </otherwise>
  100. </choose>
  101. </if>
  102. <if test="beginDate != null and beginDate != '' and beginDate > 0">
  103. and t.settle_date <![CDATA[ >= ]]> #{beginDate}
  104. </if>
  105. <if test="endDate != null and endDate != '' and endDate > 0">
  106. and t.settle_date <![CDATA[ <= ]]> #{endDate}
  107. </if>
  108. <if test="cardType != null and cardType != ''">
  109. and b.`type` = #{type}
  110. </if>
  111. <if test="email!=null and email!=''">
  112. and uc.`email` like concat(#{email},'%')
  113. </if>
  114. <if test="mobile!=null and mobile!=''">
  115. and uc.`mobile` like concat(#{mobile},'%')
  116. </if>
  117. <if test="cId != null and cId > 0">
  118. and uc.`c_id` = #{cId}
  119. </if>
  120. </where>
  121. ORDER BY t.id DESC
  122. <if test="page != null">
  123. limit #{page.offset},#{page.row}
  124. </if>
  125. </select>
  126. </mapper>