TradeVisitorMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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.yc.ship.module.trade.dal.mysql.order.TradeVisitorMapper">
  4. <select id="selectVisitorListBySupplierOrder"
  5. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  6. select v.*,d.voucher_code
  7. FROM trade_detail_base db
  8. INNER JOIN trade_detail d on d.id = db.detail_id
  9. INNER JOIN trade_visitor v on v.detail_id = d.id
  10. <where>
  11. db.plat_supplier_order_id = #{platSupplierOrderId}
  12. </where>
  13. group by v.id
  14. order by v.detail_id
  15. </select>
  16. <select id="selectVisitorListBySpecType"
  17. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  18. select v.*
  19. FROM trade_detail_base db
  20. INNER JOIN trade_detail d on d.id = db.detail_id
  21. INNER JOIN trade_visitor v on v.detail_id = d.id
  22. <where>
  23. db.plat_supplier_order_id = #{platSupplierOrderId}
  24. and db.spec_type = #{specType}
  25. and db.product_base_id in
  26. <foreach collection="baseList" index="index" item="item" open="(" separator="," close=")">
  27. #{item}
  28. </foreach>
  29. </where>
  30. group by v.id
  31. order by v.detail_id
  32. </select>
  33. <select id="selectVisitorVoucherListByOrderId"
  34. resultType="com.yc.ship.module.trade.service.order.bo.TradeVisitorBO">
  35. select v.*,d.voucher_code,d.quantity_of_one
  36. FROM trade_detail d
  37. LEFT JOIN trade_visitor v on v.detail_id = d.id
  38. <where>
  39. d.order_id = #{orderId}
  40. </where>
  41. order by d.id
  42. </select>
  43. <select id="selectInsureVisitor"
  44. resultType="com.yc.ship.module.trade.service.order.bo.TradeVisitorBO">
  45. select tv.*,td.use_date
  46. from trade_detail td
  47. inner join trade_visitor tv on tv.detail_id = td.id
  48. <where>
  49. td.order_id =#{orderId} and td.voucher_status not in (4,5) and td.voucher_status>=1 and tv.is_insure =1
  50. and td.product_id=#{productId}
  51. </where>
  52. </select>
  53. <select id="selectContractVisitor"
  54. resultType="com.yc.ship.module.trade.service.order.bo.TradeVisitorBO">
  55. select tv.*,td.use_date
  56. from trade_detail td
  57. inner join trade_visitor tv on tv.detail_id = td.id
  58. <where>
  59. td.order_id =#{orderId} and td.voucher_status not in (4,5) and td.voucher_status>=1
  60. and td.product_id=#{productId}
  61. </where>
  62. </select>
  63. <select id="selectSupplierVisitor"
  64. resultType="com.yc.ship.module.trade.service.order.bo.TradeVisitorBO">
  65. select tdb.supplier_voucher_code, v.*
  66. from trade_detail_base tdb
  67. inner join trade_visitor v on v.detail_id = tdb.detail_id
  68. <where>
  69. tdb.plat_supplier_order_id = #{platSupplierOrderId}
  70. <if test="visitorIdList!=null">
  71. and v.id in
  72. <foreach collection="visitorIdList" item="item" separator="," open="(" close=")">
  73. #{item}
  74. </foreach>
  75. </if>
  76. </where>
  77. </select>
  78. <select id="selectShipVisitor"
  79. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  80. select t.product_type productType,v.*,t3.id_card jzCard,t3.arrive_time jzTime,t3.phone jzPhone,t3.address jzAddress, a.name nationalityName from trade_detail t inner join trade_visitor v on v.detail_id = t.id
  81. left join trade_order_jz_detail t3 on v.credential_no = t3.id_card and t3.deleted =0
  82. left join area a on v.nationality = a.id
  83. where t.order_id = #{orderId} and v.deleted =0 and t.product_type =0 and t.deleted =0
  84. group by v.id
  85. </select>
  86. <select id="selectRoomShipVisitor"
  87. resultType="com.yc.ship.module.product.api.dto.OrderRoomUseDTO">
  88. select room_model_id,floor,room_id,count(1) num from trade_visitor
  89. where order_id = #{orderId} and deleted =0
  90. group by room_model_id,floor,room_id
  91. </select>
  92. <select id="selectRefundRoomShipVisitor"
  93. resultType="com.yc.ship.module.product.api.dto.OrderRoomUseDTO">
  94. select t1.room_model_id,t1.floor,t1.room_id,count(distinct t1.id) num from trade_visitor t1
  95. inner join trade_detail t2 on t1.detail_id = t2.id
  96. inner join trade_refund_detail t3 on t2.id = t3.trade_detail_id
  97. where t3.refund_id = #{refundId} and deleted =0
  98. group by t1.room_model_id,t1.floor,t1.room_id
  99. </select>
  100. <select id="selectRoomShipVisitor2"
  101. resultType="com.yc.ship.module.product.api.dto.OrderRoomUseDTO">
  102. select room_model_id,floor,'' room_id,count(1) num from trade_order_room_model
  103. where order_id = #{orderId}
  104. group by room_model_id,floor
  105. </select>
  106. <select id="queryRelatedVisitor"
  107. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  108. SELECT v1.*, v2.id associatedVisitorId
  109. FROM trade_visitor v1
  110. INNER JOIN trade_visitor v2 ON v2.ota_detail_id = v1.detail_id
  111. WHERE v2.id in
  112. <foreach collection="visitorIds" item="item" separator="," open="(" close=")">
  113. #{item}
  114. </foreach>
  115. UNION ALL
  116. SELECT v1.*, v2.id associatedVisitorId
  117. FROM trade_visitor v1
  118. INNER JOIN trade_visitor v2 ON v2.detail_id = v1.ota_detail_id
  119. WHERE v2.id in
  120. <foreach collection="visitorIds" item="item" separator="," open="(" close=")">
  121. #{item}
  122. </foreach>
  123. </select>
  124. <select id="queryVisitorByOrderId" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeVisitorRespVO">
  125. SELECT v1.*,t3.name nationalityName FROM trade_visitor v1 INNER JOIN trade_detail v2 ON v1.id = v2.visitor_id
  126. left join area t3 on v1.nationality = t3.id
  127. WHERE v2.order_id = #{orderId} and v1.deleted = 0 and v2.deleted = 0 and v2.product_type = 0
  128. </select>
  129. <select id="selectVisitorListByDate" resultType="com.yc.ship.module.trade.service.order.bo.TradeVisitorBO">
  130. select tv.*,td.product_name,td.spec_type,td.use_date,prp.name planName
  131. from trade_detail td
  132. inner join trade_order tt on td.order_id = tt.id
  133. left join product_route_plan prp on tt.route_plan_id = prp.id
  134. inner join trade_visitor tv on td.id = tv.detail_id
  135. inner join trade_detail_base tdb on td.id = tdb.detail_id
  136. where td.use_date =#{useDate} and tv.credential_no is not null
  137. and tdb.project_code='boat'
  138. and tv.is_push is null
  139. and td.voucher_status in (1,2,4,8,9)
  140. <if test="orderId!=null">
  141. and td.order_id = #{orderId}
  142. </if>
  143. <if test="tenantId!=null">
  144. and td.tenant_id = #{tenantId}
  145. </if>
  146. GROUP BY td.id,tv.id
  147. order by tv.create_time asc
  148. </select>
  149. <select id="selectBoatVisitorListByRefund" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  150. select tv.*
  151. from trade_refund tr
  152. INNER JOIN trade_refund_detail_base trdb on trdb.refund_id = tr.id
  153. INNER JOIN trade_detail_base tdb on tdb.id = trdb.trade_detail_base_id
  154. INNER JOIN trade_visitor tv on tv.detail_id = trdb.trade_detail_id
  155. where tr.id = #{refundId} and tdb.project_code = 'boat'
  156. <if test="useDate!=null">
  157. and tdb.use_date = #{useDate}
  158. </if>
  159. GROUP BY tv.id
  160. </select>
  161. <select id="selectOrderVisitorCount" resultType="java.lang.Integer">
  162. select count(*) totalCount
  163. from trade_detail td
  164. INNER JOIN trade_visitor tv on tv.detail_id = td.id
  165. where td.order_id = #{orderId}
  166. and td.voucher_status !=5
  167. </select>
  168. <select id="selectShipByOrderIds"
  169. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  170. select * from trade_visitor where detail_id in (
  171. select id from trade_detail where order_id in
  172. <foreach collection="orderIds" item="item" separator="," open="(" close=")">
  173. #{item}
  174. </foreach>
  175. )
  176. </select>
  177. <select id="queryVisitorByVovageId" resultType="java.lang.Integer">
  178. select count(*) from trade_visitor t1 inner join trade_order t2 on t1.order_id=t2.id
  179. where t1.credential_no=#{credentialNo} and t2.voyage_id=#{voyageId} and t2.order_no!=#{orderNo}
  180. and t2.deleted = 0 and t1.deleted = 0 and t2.order_status in (15, 14, 13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
  181. </select>
  182. <select id="selectListByVoyageId" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  183. select tv.*,if(pprmt.total_num &gt;=2 and pprmt.enable_share=0,1,0) as isHaveTogethers,if(pprmt.total_num =1 and pprmt.enable_share=0,1,0) as isAlone
  184. from trade_visitor tv
  185. join trade_order to1 on tv.order_id=to1.id
  186. join trade_order_room_model torm on tv.room_index_id=torm.room_index_id
  187. join product_price_room_model_type pprmt on torm.room_model_type_id = pprmt.id
  188. where to1.voyage_id=#{voyageId} and to1.order_status=6
  189. </select>
  190. <select id="selectListByVoyageIdAndRoomId"
  191. resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
  192. select tv.*
  193. from trade_visitor tv
  194. join trade_order b on tv.order_id=b.id
  195. where b.order_status=6 and b.voyage_id=#{voyageId} and if(tv.final_room_id is null,tv.init_room_id,tv.final_room_id)=#{roomId}
  196. </select>
  197. <select id="getExportVisitorList" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespExcelVO">
  198. select t1.order_no orderNo,t1.group_no groupNo,t1.order_status orderStatus,t1.source_name sourceName,t3.name name,
  199. t3.gender gender,t3.type visitorType,t3.credential_type credentialType,t3.credential_no credentialNo,
  200. t7.name nationality,t3.birthday birthday,t3.mobile mobile,t3.age age,t3.mobile mobile,t5.short_name roomModelName,t3.floor floor,t6.room_num roomName,t2.price price,t3.remark remark
  201. from trade_order t1 inner join trade_detail t2 on t1.id=t2.order_id and t2.product_type = 0 and t2.deleted = 0
  202. inner join trade_visitor t3 on t2.visitor_id=t3.id and t3.deleted =0
  203. left join trade_order_room_model t4 on t3.room_index_id=t4.room_index_id and t4.deleted=0
  204. left join resource_room_model t5 on t4.room_model_id = t5.id and t5.deleted=0
  205. left join resource_room t6 on t3.room_id = t6.id and t6.deleted=0
  206. left join area t7 on t3.nationality = t7.id
  207. where t1.order_status in (15, 14, 13, 11, 10, 12, 9, 8, 7, 6, 5, 4, 3, 2, 1)
  208. <if test="vo.orderNo != null and vo.orderNo != ''">
  209. AND t1.order_no = #{vo.orderNo}
  210. </if>
  211. <if test="vo.voyageId != null and vo.voyageId != ''">
  212. AND t1.voyage_id = #{vo.voyageId}
  213. </if>
  214. <if test="vo.otaId != null and vo.otaId != ''">
  215. AND t1.source_id = #{vo.otaId}
  216. </if>
  217. <if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
  218. and t1.order_status in
  219. <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
  220. #{item}
  221. </foreach>
  222. </if>
  223. </select>
  224. <!-- 查询游客名单导出游客列表 -->
  225. <select id="selectTouristExportVisitor" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TouristExportVisitorVO">
  226. SELECT
  227. od.name AS sourceName,
  228. tor.order_no AS orderNo,
  229. tor.group_no AS groupNo,
  230. CASE WHEN rr.direction = 1 THEN '上水' ELSE '下水' END AS direction,
  231. CASE WHEN tjz.is_jz = 1 THEN '是' ELSE '否' END AS jz,
  232. DATE_FORMAT(pv.start_time, '%Y.%m.%d') AS travelDate,
  233. tor.pay_amount AS amount,
  234. top.pay_amount AS payAmount,
  235. tor.deposi,
  236. tv.room_index_id AS roomIndexId,
  237. torm.room_model_name AS roomType,
  238. tv.name,
  239. tv.gender,
  240. tv.birthday,
  241. tv.mobile,
  242. tv.order_id as orderId,
  243. tv.credential_type AS credentialType,
  244. tv.credential_no AS credentialNo,
  245. tv.type AS visitorType,
  246. tv.floor as floor,
  247. a.name AS nationalityName,
  248. GROUP_CONCAT(ps.product_name) AS valueAddedService,
  249. tor.remark,
  250. tor.order_status as orderStatus
  251. FROM trade_visitor tv
  252. INNER JOIN trade_order tor ON tv.order_id = tor.id AND tor.deleted = 0
  253. INNER JOIN trade_detail td ON tv.id = td.visitor_id AND td.deleted = 0
  254. LEFT JOIN area a ON tv.nationality = a.id
  255. LEFT JOIN product_voyage pv ON tor.voyage_id = pv.id
  256. LEFT JOIN resource_route rr ON pv.route_id = rr.id
  257. LEFT JOIN ota_distributor od ON tor.source_id = od.id
  258. LEFT JOIN trade_order_room_model torm ON tv.room_index_id = torm.room_index_id AND torm.deleted = 0
  259. left JOIN product_spu ps on ps.id = td.product_id
  260. left join trade_order_pay top ON top.order_id = tor.id and top.deleted = 0 and top.pay_status = 1
  261. left Join trade_order_jz tjz on tjz.order_id = tor.id
  262. WHERE tv.deleted = 0
  263. <if test="vo.orderNo != null and vo.orderNo != ''">
  264. AND tor.order_no = #{vo.orderNo}
  265. </if>
  266. <if test="vo.voyageId != null and vo.voyageId != ''">
  267. AND tor.voyage_id = #{vo.voyageId}
  268. </if>
  269. <if test="vo.shipId != null and vo.shipId != ''">
  270. AND pv.ship_id = #{vo.shipId}
  271. </if>
  272. <if test="vo.routeId != null and vo.routeId != ''">
  273. AND pv.route_id = #{vo.routeId}
  274. </if>
  275. <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
  276. AND pv.start_time &gt;= #{vo.travelDateStart}
  277. </if>
  278. <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
  279. AND pv.start_time &lt;= #{vo.travelDateEnd}
  280. </if>
  281. <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
  282. AND tor.create_time &gt;= #{vo.orderDateStart}
  283. </if>
  284. <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
  285. AND tor.create_time &lt;= #{vo.orderDateEnd}
  286. </if>
  287. <if test="vo.orderStatus != null and vo.orderStatus.size() > 0">
  288. AND tor.order_status IN
  289. <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
  290. #{item}
  291. </foreach>
  292. </if>
  293. <if test="vo.userName != null and vo.userName != ''">
  294. AND tv.name LIKE CONCAT('%', #{vo.userName}, '%')
  295. </if>
  296. <if test="vo.credentialNo != null and vo.credentialNo != ''">
  297. AND tv.credential_no = #{vo.credentialNo}
  298. </if>
  299. <if test="vo.roomModelId != null and vo.roomModelId != ''">
  300. AND torm.room_model_id = #{vo.roomModelId}
  301. </if>
  302. <if test="vo.floor != null and vo.floor != ''">
  303. AND tv.floor = #{vo.floor}
  304. </if>
  305. <if test="vo.otaId != null and vo.otaId != ''">
  306. AND tor.source_id = #{vo.otaId}
  307. </if>
  308. <if test="vo.distributorId != null and vo.distributorId != ''">
  309. AND tor.source_id = #{vo.distributorId}
  310. </if>
  311. <if test="vo.otaCateId != null and vo.otaCateId != ''">
  312. AND od.ota_category_id = #{vo.otaCateId}
  313. </if>
  314. <if test="vo.otaCateIds != null and vo.otaCateIds.size() > 0">
  315. AND od.ota_category_id IN
  316. <foreach collection="vo.otaCateIds" item="item" separator="," open="(" close=")">
  317. #{item}
  318. </foreach>
  319. </if>
  320. <if test="vo.contactName != null and vo.contactName != ''">
  321. AND tor.link_man LIKE CONCAT('%', #{vo.contactName}, '%')
  322. </if>
  323. <if test="vo.mobile != null and vo.mobile != ''">
  324. AND tor.link_mobile = #{vo.mobile}
  325. </if>
  326. group by tv.id
  327. ORDER BY od.id ASC,tor.order_no ASC, tv.room_index_id ASC
  328. </select>
  329. <select id="selectPersonDesc" resultType="com.yc.ship.module.trade.controller.app.otc.vo.AppPersonDescVO">
  330. select order_id,name, count(1) num
  331. from trade_visitor
  332. where deleted = 0 and order_id in
  333. <foreach item="item" collection="orderIds" separator="," open="(" close=")">
  334. #{item}
  335. </foreach>
  336. GROUP BY order_id
  337. </select>
  338. <select id="selectWithLeaderStatsByOrderIds"
  339. resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.OrderWithLeaderStatVO">
  340. select
  341. type,
  342. if(gender=0,'女','男') gender,
  343. count(1) num
  344. from trade_visitor
  345. where deleted = 0 and (type = 'with' or type = 'leader') and order_id in
  346. <foreach item="item" collection="orderIds" separator="," open="(" close=")">
  347. #{item}
  348. </foreach>
  349. GROUP BY type, gender
  350. </select>
  351. <select id="selectOrderCountryStatsByOrderIds"
  352. resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.OrderTotalCountryVO">
  353. SELECT
  354. d1.country_id,
  355. d2.country_name,
  356. d1.adultNum,
  357. d1.childNum,
  358. d1.babyNum,
  359. d1.leaderNum,
  360. d1.withNum,
  361. d2.twoNum,
  362. d2.threeNum,
  363. d2.fourNum,
  364. d2.fiveNum,
  365. d2.sixNum
  366. FROM
  367. (
  368. SELECT
  369. a1.country_id,
  370. a1.country_name,
  371. sum( CASE WHEN a1.type = 'adultTake' OR a1.type = 'adultPlus' THEN a1.num ELSE 0 END ) AS adultNum,
  372. sum( CASE WHEN a1.type = 'childTake' OR a1.type = 'childNonTake' or a1.type = 'childPlus' THEN a1.num ELSE 0 END ) AS childNum,
  373. sum( CASE WHEN a1.type = 'babyTake' OR a1.type = 'babyNonTake' or a1.type = 'babyPlus' THEN a1.num ELSE 0 END ) AS babyNum,
  374. sum( CASE WHEN a1.type = 'leader' THEN a1.num ELSE 0 END ) AS leaderNum,
  375. sum( CASE WHEN a1.type = 'with' THEN a1.num ELSE 0 END ) AS withNum
  376. FROM
  377. (
  378. SELECT
  379. t1.nationality country_id,
  380. t2.`name` country_name,
  381. t1.type,
  382. count( t1.id ) num
  383. FROM
  384. trade_visitor t1
  385. LEFT JOIN area t2 ON t1.nationality = t2.id
  386. WHERE
  387. t1.deleted = 0
  388. AND t1.nationality IS NOT NULL
  389. AND t1.nationality != ''
  390. and t1.order_id in
  391. <foreach item="item" collection="orderIds" separator="," open="(" close=")">
  392. #{item}
  393. </foreach>
  394. GROUP BY
  395. t1.nationality,
  396. t1.type
  397. ) a1
  398. GROUP BY
  399. a1.country_id
  400. ORDER BY
  401. a1.country_id ASC
  402. ) d1
  403. LEFT JOIN (
  404. SELECT
  405. a1.country_id,
  406. a1.country_name,
  407. sum( CASE WHEN a1.floor = 2 THEN a1.num ELSE 0 END ) AS twoNum,
  408. sum( CASE WHEN a1.floor = 3 THEN a1.num ELSE 0 END ) AS threeNum,
  409. sum( CASE WHEN a1.floor = 4 THEN a1.num ELSE 0 END ) AS fourNum,
  410. sum( CASE WHEN a1.floor = 5 THEN a1.num ELSE 0 END ) AS fiveNum,
  411. sum( CASE WHEN a1.floor = 6 THEN a1.num ELSE 0 END ) AS sixNum
  412. FROM
  413. (
  414. SELECT
  415. t1.nationality country_id,
  416. t2.`name` country_name,
  417. t3.floor,
  418. count( t1.id ) num
  419. FROM
  420. trade_visitor t1
  421. LEFT JOIN area t2 ON t1.nationality = t2.id
  422. LEFT JOIN trade_order_room_model t3 ON t1.room_index_id = t3.room_index_id
  423. WHERE
  424. t1.deleted = 0
  425. AND t3.deleted = 0
  426. AND t1.nationality IS NOT NULL
  427. AND t1.nationality != ''
  428. and t1.order_id in
  429. <foreach item="item" collection="orderIds" separator="," open="(" close=")">
  430. #{item}
  431. </foreach>
  432. GROUP BY
  433. t1.nationality,
  434. t3.floor
  435. ) a1
  436. GROUP BY
  437. a1.country_id
  438. ORDER BY
  439. a1.country_id ASC
  440. ) d2 ON d1.country_id = d2.country_id
  441. ORDER BY
  442. d1.country_id ASC
  443. </select>
  444. <select id="selectPersonListByOrderId"
  445. resultType="com.yc.ship.module.trade.controller.app.otc.vo.AppItineraryPersonVO">
  446. SELECT
  447. t1.id,
  448. t1.NAME,
  449. t1.mobile,
  450. t1.final_room_id,
  451. t2.room_num final_room_name,
  452. t1.init_room_id,
  453. t3.room_num init_room_name,
  454. t1.room_id,
  455. t4.room_num room_name
  456. FROM
  457. trade_visitor t1
  458. LEFT JOIN resource_room t2 ON t1.final_room_id = t2.id
  459. LEFT JOIN resource_room t3 ON t1.init_room_id = t3.id
  460. LEFT JOIN resource_room t4 ON t1.room_id = t4.id
  461. WHERE
  462. t1.deleted = 0
  463. AND t1.order_id = #{orderId}
  464. </select>
  465. </mapper>