LawyerConsultationOrderMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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="shop.alien.mapper.LawyerConsultationOrderMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="shop.alien.entity.store.LawyerConsultationOrder">
  6. <id column="id" property="id" />
  7. <result column="order_number" property="orderNumber" />
  8. <result column="client_user_id" property="clientUserId" />
  9. <result column="lawyer_user_id" property="lawyerUserId" />
  10. <result column="problem_scenario_id" property="problemScenarioId" />
  11. <result column="problem_description" property="problemDescription" />
  12. <result column="order_amount" property="orderAmount" />
  13. <result column="consultation_fee" property="consultationFee" />
  14. <result column="start_time" property="startTime" />
  15. <result column="end_time" property="endTime" />
  16. <result column="order_status" property="orderStatus" />
  17. <result column="payment_status" property="paymentStatus" />
  18. <result column="order_time" property="orderTime" />
  19. <result column="payment_time" property="paymentTime" />
  20. <result column="validity_period" property="validityPeriod" />
  21. <result column="rating" property="rating" />
  22. <result column="comment" property="comment" />
  23. <result column="delete_flag" property="deleteFlag" />
  24. <result column="created_time" property="createdTime" />
  25. <result column="created_user_id" property="createdUserId" />
  26. <result column="updated_time" property="updatedTime" />
  27. <result column="updated_user_id" property="updatedUserId" />
  28. <result column="alipay_no" property="alipayNo" />
  29. <result column="order_str" property="orderStr" />
  30. <result column="place_id" property="placeId" />
  31. <result column="lawyer_earnings" property="lawyerEarnings" />
  32. <result column="accept_orders_time" property="acceptOrdersTime" />
  33. <result column="reason_order_refusal" property="reasonOrderRefusal" />
  34. <result column="accept_orders_status" property="acceptOrdersStatus" />
  35. <result column="apply_refund_status" property="applyRefundStatus" />
  36. <result column="apply_refund_time" property="applyRefundTime" />
  37. <result column="apply_refund_process_time" property="applyRefundProcessTime" />
  38. <result column="apply_refund_reason" property="applyRefundReason" />
  39. <result column="reject_refund_reason" property="rejectRefundReason" />
  40. <result column="is_appealed" property="isAppealed" />
  41. </resultMap>
  42. <!-- 通用查询结果列 -->
  43. <sql id="Base_Column_List">
  44. id, order_number, client_user_id, lawyer_user_id, problem_scenario_id, problem_description,
  45. order_amount, consultation_fee, start_time, end_time, order_status, payment_status,
  46. order_time,payment_time, validity_period, rating, comment, delete_flag, created_time,
  47. created_user_id, updated_time, updated_user_id, alipay_no, order_str, place_id
  48. </sql>
  49. <!-- 訂單VO結果映射,包含律師信息 -->
  50. <resultMap id="OrderVOWithLawyerResultMap" type="shop.alien.entity.store.vo.LawyerConsultationOrderVO">
  51. <!-- 訂單基本信息 -->
  52. <id column="id" property="id" />
  53. <result column="order_number" property="orderNumber" />
  54. <result column="client_user_id" property="clientUserId" />
  55. <result column="lawyer_user_id" property="lawyerUserId" />
  56. <result column="problem_scenario_id" property="problemScenarioId" />
  57. <result column="problem_description" property="problemDescription" />
  58. <result column="order_amount" property="orderAmount" />
  59. <result column="consultation_fee" property="consultationFee" />
  60. <result column="start_time" property="startTime" />
  61. <result column="end_time" property="endTime" />
  62. <result column="order_status" property="orderStatus" />
  63. <result column="payment_status" property="paymentStatus" />
  64. <result column="order_time" property="orderTime" />
  65. <result column="payment_time" property="paymentTime" />
  66. <result column="validity_period" property="validityPeriod" />
  67. <result column="rating" property="rating" />
  68. <result column="comment" property="comment" />
  69. <result column="created_time" property="createdTime" />
  70. <!-- 律師信息 -->
  71. <result column="lawyer_name" property="lawyerName" />
  72. <result column="lawyer_phone" property="lawyerPhone" />
  73. <result column="lawyer_email" property="lawyerEmail" />
  74. <result column="lawyer_certificate_no" property="lawyerCertificateNo" />
  75. <result column="law_firm" property="lawFirm" />
  76. <result column="practice_years" property="practiceYears" />
  77. <result column="specialty_fields" property="specialtyFields" />
  78. <result column="certification_status" property="certificationStatus" />
  79. <result column="service_score" property="serviceScore" />
  80. <result column="service_count" property="serviceCount" />
  81. <result column="lawyer_consultation_fee" property="lawyerConsultationFee" />
  82. <result column="province" property="province" />
  83. <result column="city" property="city" />
  84. <result column="district" property="district" />
  85. <result column="address" property="address" />
  86. <result column="head_img" property="headImg" />
  87. <result column="nick_name" property="nickName" />
  88. <result column="personal_introduction" property="personalIntroduction" />
  89. <result column="expertise_area_info" property="expertiseAreaInfo" />
  90. <result column="alipay_no" property="alipayNo" />
  91. <result column="order_str" property="orderStr" />
  92. </resultMap>
  93. <!-- 分頁查詢訂單列表,聯查律師信息 -->
  94. <select id="getConsultationOrderListWithLawyer" resultMap="OrderVOWithLawyerResultMap">
  95. SELECT
  96. o.id,
  97. o.order_number,
  98. o.client_user_id,
  99. o.lawyer_user_id,
  100. o.problem_scenario_id,
  101. o.problem_description,
  102. o.order_amount,
  103. o.consultation_fee,
  104. o.start_time,
  105. o.end_time,
  106. o.order_status,
  107. o.payment_status,
  108. o.order_time,
  109. o.payment_time,
  110. o.validity_period,
  111. o.rating,
  112. o.comment,
  113. o.created_time,
  114. -- 律師信息
  115. l.name AS lawyer_name,
  116. l.phone AS lawyer_phone,
  117. l.email AS lawyer_email,
  118. l.lawyer_certificate_no,
  119. l.law_firm,
  120. l.practice_years,
  121. l.specialty_fields,
  122. l.certification_status,
  123. l.service_score,
  124. l.service_count,
  125. l.consultation_fee AS lawyer_consultation_fee,
  126. l.province,
  127. l.city,
  128. l.district,
  129. l.address,
  130. l.head_img,
  131. l.nick_name,
  132. l.personal_introduction
  133. FROM lawyer_consultation_order o
  134. LEFT JOIN lawyer_user l ON o.lawyer_user_id = l.id AND l.delete_flag = 0
  135. WHERE o.delete_flag = 0
  136. <if test="orderNumber != null and orderNumber != ''">
  137. AND o.order_number = #{orderNumber}
  138. </if>
  139. <if test="clientUserId != null">
  140. AND o.client_user_id = #{clientUserId}
  141. </if>
  142. <if test="lawyerUserId != null">
  143. AND o.lawyer_user_id = #{lawyerUserId}
  144. </if>
  145. <if test="lawyerUserIds != null and lawyerUserIds.size() > 0">
  146. AND o.lawyer_user_id IN
  147. <foreach collection="lawyerUserIds" item="id" open="(" separator="," close=")">
  148. #{id}
  149. </foreach>
  150. </if>
  151. <if test="lawyerName != null and lawyerName != '' and (lawyerUserIds == null or lawyerUserIds.size() == 0)">
  152. AND l.name LIKE CONCAT('%', #{lawyerName}, '%')
  153. </if>
  154. <if test="orderStatus != null">
  155. AND o.order_status = #{orderStatus}
  156. </if>
  157. ORDER BY o.created_time DESC
  158. </select>
  159. <!-- 根据用户ID查询订单列表 -->
  160. <select id="getConsultationOrderListById" resultMap="OrderVOWithLawyerResultMap">
  161. SELECT
  162. lco.id,
  163. lco.order_number,
  164. lco.client_user_id,
  165. lco.lawyer_user_id,
  166. lco.problem_scenario_id,
  167. lco.problem_description,
  168. lco.order_amount,
  169. lco.consultation_fee,
  170. lco.start_time,
  171. lco.end_time,
  172. lco.order_status,
  173. lco.payment_status,
  174. lco.order_time,
  175. lco.payment_time,
  176. lco.validity_period,
  177. lco.rating,
  178. lco.comment,
  179. lco.created_time,
  180. lco.alipay_no,
  181. lco.order_str,
  182. lu.name AS lawyer_name,
  183. lu.phone AS lawyer_phone,
  184. lu.email AS lawyer_email,
  185. lu.lawyer_certificate_no,
  186. lu.law_firm,
  187. lu.practice_years,
  188. lu.specialty_fields,
  189. lu.certification_status,
  190. lu.service_score,
  191. lu.service_count,
  192. lu.consultation_fee AS lawyer_consultation_fee,
  193. lu.province,
  194. lu.city,
  195. lu.district,
  196. lu.address,
  197. lu.head_img,
  198. lu.nick_name,
  199. lu.personal_introduction,
  200. lea.expertise_area_info
  201. FROM lawyer_consultation_order lco
  202. LEFT JOIN lawyer_user lu ON lco.lawyer_user_id = lu.id AND lu.delete_flag = 0
  203. left join lawyer_expertise_area lea on lea.id = lu.lawyer_expertise_area_id and lea.delete_flag = 0
  204. WHERE lco.delete_flag = 0
  205. <if test="userId != null and userId !=''">
  206. AND lco.client_user_id = #{userId}
  207. </if>
  208. <if test="lawyerUserIds != null and lawyerUserIds.size() > 0">
  209. AND lco.lawyer_user_id IN
  210. <foreach collection="lawyerUserIds" item="id" open="(" separator="," close=")">
  211. #{id}
  212. </foreach>
  213. </if>
  214. <if test="orderStatus != null and orderStatus !=''">
  215. AND lco.order_status = #{orderStatus}
  216. </if>
  217. ORDER BY lco.created_time DESC
  218. </select>
  219. </mapper>