OrderGoodsRefundMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.zhongzheng.modules.order.mapper.OrderGoodsRefundMapper">
  6. <resultMap type="com.zhongzheng.modules.order.domain.OrderGoodsRefund" id="OrderGoodsRefundResult">
  7. <result property="refundId" column="refund_id"/>
  8. <result property="refundSn" column="refund_sn"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="orderSn" column="order_sn"/>
  11. <result property="goodsId" column="goods_id"/>
  12. <result property="refundFee" column="refund_fee"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="status" column="status"/>
  16. <result property="wxpayRefundId" column="wxpay_refund_id"/>
  17. <result property="applyReason" column="apply_reason"/>
  18. <result property="applyImgs" column="apply_imgs"/>
  19. <result property="type" column="type"/>
  20. <result property="orderGoodsId" column="order_goods_id"/>
  21. <result property="periodStatus" column="period_status"/>
  22. <result property="periodReason" column="period_reason"/>
  23. <result property="periodReviewReason" column="period_review_reason"/>
  24. <result property="periodUsername" column="period_username"/>
  25. <result property="periodReviewUsername" column="period_review_username"/>
  26. <result property="periodTime" column="period_time"/>
  27. <result property="periodReviewTime" column="period_review_time"/>
  28. <result property="refundTime" column="refund_time"/>
  29. </resultMap>
  30. <resultMap type="com.zhongzheng.modules.order.vo.OrderGoodsRefundVo" id="OrderGoodsRefundVoResult">
  31. <result property="refundId" column="refund_id"/>
  32. <result property="refundSn" column="refund_sn"/>
  33. <result property="userId" column="user_id"/>
  34. <result property="orderSn" column="order_sn"/>
  35. <result property="goodsId" column="goods_id"/>
  36. <result property="refundFee" column="refund_fee"/>
  37. <result property="createTime" column="create_time"/>
  38. <result property="status" column="status"/>
  39. <result property="wxpayRefundId" column="wxpay_refund_id"/>
  40. <result property="goodsName" column="goods_name"/>
  41. <result property="coverUrl" column="cover_url"/>
  42. <result property="applyReason" column="apply_reason"/>
  43. <result property="applyImgs" column="apply_imgs"/>
  44. <result property="type" column="type"/>
  45. <result property="orderGoodsId" column="order_goods_id"/>
  46. <result property="periodStatus" column="period_status"/>
  47. <result property="periodReason" column="period_reason"/>
  48. <result property="periodReviewReason" column="period_review_reason"/>
  49. <result property="periodUsername" column="period_username"/>
  50. <result property="periodReviewUsername" column="period_review_username"/>
  51. <result property="periodTime" column="period_time"/>
  52. <result property="periodReviewTime" column="period_review_time"/>
  53. <result property="realname" column="realname"/>
  54. <result property="educationName" column="education_name"/>
  55. <result property="projectName" column="project_name"/>
  56. <result property="businessName" column="business_name"/>
  57. <result property="goodsPrice" column="goods_price"/>
  58. <result property="goodsRealPrice" column="goods_real_price"/>
  59. <result property="goodsReceived" column="goods_received"/>
  60. <result property="payStatus" column="pay_status"/>
  61. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  62. <result property="telphone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  63. <result property="year" column="year"/>
  64. <result property="refundTime" column="refund_time"/>
  65. </resultMap>
  66. <select id="selectListByBo" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsRefundQueryBo" resultMap="OrderGoodsRefundVoResult">
  67. SELECT
  68. gr.*,
  69. g.goods_name,
  70. g.cover_url,
  71. g.year,
  72. u.realname,
  73. u.id_card,
  74. u.telphone,
  75. cet.education_name,
  76. cpt.project_name,
  77. cb.business_name,
  78. og.goods_received,
  79. og.goods_real_price,
  80. og.pay_status,
  81. og.goods_price
  82. FROM
  83. order_goods_refund gr
  84. LEFT JOIN goods g ON gr.goods_id = g.goods_id
  85. LEFT JOIN `user` u ON gr.user_id = u.user_id
  86. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  87. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  88. LEFT JOIN course_business cb ON g.business_id = cb.id
  89. LEFT JOIN order_goods og ON gr.order_goods_id = og.order_goods_id
  90. where 1=1
  91. <if test="userId != null and userId != ''">
  92. AND gr.user_id = #{userId}
  93. </if>
  94. <if test="orderGoodsId != null and orderGoodsId != ''">
  95. AND gr.order_goods_id = #{orderGoodsId}
  96. </if>
  97. <if test="type != null">
  98. AND gr.type = #{type}
  99. </if>
  100. <if test="periodStatus != null ">
  101. AND gr.period_status in
  102. <foreach collection="periodStatus" item="item" index="index" open="(" close=")" separator=",">
  103. #{item}
  104. </foreach>
  105. </if>
  106. <if test="businessId != null and businessId != ''">
  107. AND g.business_id = #{businessId}
  108. </if>
  109. <if test="goodsType != null and goodsType != ''">
  110. AND g.goods_type = #{goodsType}
  111. </if>
  112. <if test="searchKey != null and searchKey != '' ">
  113. and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or og.order_sn = #{searchKey})
  114. </if>
  115. <if test="searchStartTime != null and searchStartTime !='' ">
  116. AND og.create_time >=#{searchStartTime}
  117. </if>
  118. <if test="searchEndTime != null and searchEndTime !='' ">
  119. AND #{searchEndTime} >= og.create_time
  120. </if>
  121. -- ORDER BY gr.refund_id DESC
  122. ORDER BY gr.order_sn ASC , gr.create_time ASC
  123. </select>
  124. <select id="selectCountConfirmPeriod" parameterType="map" resultType="Long">
  125. SELECT
  126. COUNT(1)
  127. FROM
  128. order_goods_refund gr JOIN goods g on gr.goods_id = g.goods_id JOIN course_business b on g.business_id = b.id
  129. WHERE
  130. 1 = 1
  131. AND gr.refund_id = #{refundId}
  132. and FIND_IN_SET(#{userId},b.refund_confirm_user_ids)
  133. </select>
  134. <select id="selectCountFirstPeriod" parameterType="map" resultType="Long">
  135. SELECT
  136. COUNT(1)
  137. FROM
  138. order_goods_refund gr JOIN goods g on gr.goods_id = g.goods_id JOIN course_business b on g.business_id = b.id
  139. WHERE
  140. 1 = 1
  141. AND gr.refund_id = #{refundId}
  142. and FIND_IN_SET(#{userId},b.refund_user_ids)
  143. </select>
  144. </mapper>