TradeVisitorMapper.xml 23 KB

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