BootACourseMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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="beilv.bootacourse.mapper.BootACourseMapper">
  6. <resultMap type="BootACourse" id="BootACourseResult">
  7. <result property="id" column="id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="contactPeople" column="contact_people"/>
  10. <result property="contactNumber" column="contact_number"/>
  11. <result property="registrationTime" column="registration_time"/>
  12. <result property="paymentTime" column="payment_time"/>
  13. <result property="cancellationTime" column="cancellation_time"/>
  14. <result property="refundTime" column="refund_time"/>
  15. <result property="paymentStatus" column="payment_status"/>
  16. <result property="orderId" column="order_id"/>
  17. <result property="ticketId" column="ticket_id"/>
  18. <result property="orderType" column="order_type"/>
  19. <result property="refundInstructions" column="refund_instructions"/>
  20. <result property="clubCardId" column="club_card_id"/>
  21. <result property="refund" column="refund"/>
  22. <result property="verificationTime" column="verification_time"/>
  23. <result property="session" column="session"/>
  24. <result property="ticketDate" column="ticket_date"/>
  25. <result property="siteName" column="site_name"/>
  26. <result property="cover" column="cover"/>
  27. </resultMap>
  28. <insert id="addCourse" parameterType="bootACourse">
  29. insert into beilv_book_a_course
  30. <trim prefix="(" suffix=")" suffixOverrides=",">
  31. <if test="userId != null">user_id,</if>
  32. <if test="contactPeople != null">contact_people,</if>
  33. <if test="contactNumber != null">contact_number,</if>
  34. <if test="registrationTime != null">registration_time,</if>
  35. <if test="paymentTime != null">payment_time,</if>
  36. <if test="cancellationTime != null">cancellation_time,</if>
  37. <if test="refundTime != null">refund_time,</if>
  38. <if test="paymentStatus != null">payment_status,</if>
  39. <if test="orderId != null">order_id,</if>
  40. <if test="ticketId != null">ticket_id,</if>
  41. <if test="orderType != null">order_type,</if>
  42. <if test="refundInstructions != null">refund_instructions,</if>
  43. <if test="clubCardId != null">club_card_id,</if>
  44. <if test="refund != null">refund,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="userId != null">#{userId},</if>
  48. <if test="contactPeople != null">#{contactPeople},</if>
  49. <if test="contactNumber != null">#{contactNumber},</if>
  50. <if test="registrationTime != null">#{registrationTime},</if>
  51. <if test="paymentTime != null">#{paymentTime},</if>
  52. <if test="cancellationTime != null">#{cancellationTime},</if>
  53. <if test="refundTime != null">#{refundTime},</if>
  54. <if test="paymentStatus != null">#{paymentStatus},</if>
  55. <if test="orderId != null">#{orderId},</if>
  56. <if test="ticketId != null">#{ticketId},</if>
  57. <if test="orderType != null">#{orderType},</if>
  58. <if test="refundInstructions != null">#{refundInstructions},</if>
  59. <if test="clubCardId != null">#{clubCardId},</if>
  60. <if test="refund != null">#{refund},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateCourse" parameterType="bootACourse">
  64. update beilv_book_a_course
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="paymentTime != null">payment_time = #{paymentTime},</if>
  67. <if test="cancellationTime != null">cancellation_time = #{cancellationTime},</if>
  68. <if test="refundTime != null">refund_time = #{refundTime},</if>
  69. <if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
  70. <if test="refundInstructions != null">refund_instructions = #{refundInstructions},</if>
  71. </trim>
  72. <where>
  73. <if test="orderId != null and orderId != ''">
  74. and order_id = #{orderId}
  75. </if>
  76. <if test="id != null and id != ''">
  77. and id = #{id}
  78. </if>
  79. </where>
  80. </update>
  81. <select id="getCourseList" parameterType="bootACourseBO" resultMap="BootACourseResult">
  82. select
  83. bbac.user_id, bbac.contact_people, bbac.contact_number, bbac.registration_time, bbac.payment_time, bbac.cancellation_time, bbac.refund_time,
  84. bbac.payment_status, bbac.order_id, bbac.ticket_id, bbac.order_type, bbac.refund_instructions, bbac.club_card_id, bbac.refund, bbac.verification_time,
  85. bat.session, bat.ticket_date, bs.name as site_name, bs.cover
  86. from beilv_book_a_course bbac
  87. left join beilv_admission_ticket bat on bbac.ticket_id = bat.id
  88. left join beilv_site bs on bat.site_id = bs.id
  89. <where>
  90. <if test="userId != null and userId != ''">
  91. and bbac.user_id = #{userId}
  92. </if>
  93. <if test="paymentStatus != null and paymentStatus != ''">
  94. and bbac.paymen_status = #{paymentStatus}
  95. </if>
  96. </where>
  97. order by bbac.registration_time desc
  98. </select>
  99. <select id="getCourseInfo" parameterType="bootACourseBO" resultMap="BootACourseResult">
  100. select * from beilv_book_a_course
  101. <where>
  102. <if test="userId != null and userId != ''">
  103. and user_id = #{userId}
  104. </if>
  105. <if test="orderId != null and orderId != ''">
  106. and order_id = #{orderId}
  107. </if>
  108. </where>
  109. order by registration_time desc
  110. </select>
  111. <select id="selectPaidOrders" parameterType="bootACourse" resultMap="BootACourseResult">
  112. SELECT
  113. *
  114. FROM
  115. beilv_book_a_course
  116. WHERE
  117. payment_status = 'payment_status_have_paid'
  118. </select>
  119. <update id="updateOrderStatusToVerification" parameterType="bootACourse">
  120. UPDATE beilv_book_a_course
  121. SET payment_status = 'payment_status_verification',
  122. verification_time = #{verificationTime}
  123. WHERE order_id IN
  124. <foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
  125. #{orderId}
  126. </foreach>
  127. </update>
  128. </mapper>