|
|
@@ -10,14 +10,16 @@
|
|
|
|
|
|
<select id="selectPage2"
|
|
|
resultType="com.yc.ship.module.trade.dal.dataobject.orderjzdetail.OrderJzDetailDO">
|
|
|
- select distinct d.* , r.direction , rm.name as room_model_name
|
|
|
+ select distinct d.* , r.direction , rm.name as room_model_name,
|
|
|
+ SUBSTRING_INDEX(o.order_no, '-', -1) as orderNo, dj.dispatch_no as dispatchNo, dj.group_no as groupNo
|
|
|
from trade_order_jz_detail d
|
|
|
inner join trade_order_jz oz on d.jz_id = oz.id
|
|
|
inner join trade_order o on o.deleted = 0 and o.id = oz.order_id
|
|
|
inner join product_voyage v on o.voyage_id = v.id
|
|
|
inner join resource_route r on v.route_id = r.id
|
|
|
- inner join trade_visitor u on u.credential_no = d.id_card
|
|
|
- inner join resource_room_model rm on u.room_model_id = rm.id
|
|
|
+ inner join trade_visitor u on u.credential_no = d.id_card and u.order_id = oz.order_id
|
|
|
+ left join resource_room_model rm on u.room_model_id = rm.id
|
|
|
+ left join trade_order_jz_dispatch dj on d.dispatch_id = dj.id
|
|
|
where d.deleted = 0 and o.voyage_id = #{vo.voyageId}
|
|
|
<if test="vo.idCard != null">
|
|
|
and d.id_card like concat('%', #{vo.idCard}, '%')
|
|
|
@@ -31,8 +33,59 @@
|
|
|
<if test="vo.arriveTime != null">
|
|
|
and d.arrive_time = #{vo.arriveTime}
|
|
|
</if>
|
|
|
- order by d.address asc, d.arrive_time asc, d.batch_no asc
|
|
|
+ <if test="vo.dispatchNo != null and vo.dispatchNo != ''">
|
|
|
+ and dj.dispatch_no like concat('%', #{vo.dispatchNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 1">
|
|
|
+ and d.sign_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 0">
|
|
|
+ and d.sign_time is null
|
|
|
+ </if>
|
|
|
+ order by CAST(SUBSTRING_INDEX(o.order_no, '-', -1) AS UNSIGNED) asc,
|
|
|
+ d.address asc, d.arrive_time asc, d.batch_no asc
|
|
|
</select>
|
|
|
+
|
|
|
+ <!-- selectVisitorExportList: 导出游客接站明细,条件与selectPage2一致,不分页 -->
|
|
|
+ <select id="selectVisitorExportList"
|
|
|
+ resultType="com.yc.ship.module.trade.dal.dataobject.orderjzdetail.OrderJzDetailDO">
|
|
|
+ select distinct d.* , r.direction , rm.name as room_model_name,
|
|
|
+ SUBSTRING_INDEX(o.order_no, '-', -1) as orderNo, dj.dispatch_no as dispatchNo, dj.group_no as groupNo
|
|
|
+ from trade_order_jz_detail d
|
|
|
+ inner join trade_order_jz oz on d.jz_id = oz.id
|
|
|
+ inner join trade_order o on o.deleted = 0 and o.id = oz.order_id
|
|
|
+ inner join product_voyage v on o.voyage_id = v.id
|
|
|
+ inner join resource_route r on v.route_id = r.id
|
|
|
+ inner join trade_visitor u on u.credential_no = d.id_card and u.order_id = oz.order_id
|
|
|
+ left join resource_room_model rm on u.room_model_id = rm.id
|
|
|
+ left join trade_order_jz_dispatch dj on d.dispatch_id = dj.id
|
|
|
+ inner join trade_detail td on td.order_id = o.id and td.product_id = 2034458675435925505
|
|
|
+ where d.deleted = 0 and o.voyage_id = #{vo.voyageId}
|
|
|
+ <if test="vo.idCard != null and vo.idCard != ''">
|
|
|
+ and d.id_card like concat('%', #{vo.idCard}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.name != null and vo.name != ''">
|
|
|
+ and d.name like concat('%', #{vo.name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.address != null and vo.address != ''">
|
|
|
+ and d.address = #{vo.address}
|
|
|
+ </if>
|
|
|
+ <if test="vo.arriveTime != null and vo.arriveTime != ''">
|
|
|
+ and d.arrive_time = #{vo.arriveTime}
|
|
|
+ </if>
|
|
|
+ <if test="vo.dispatchNo != null and vo.dispatchNo != ''">
|
|
|
+ and dj.dispatch_no like concat('%', #{vo.dispatchNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 1">
|
|
|
+ and d.sign_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 0">
|
|
|
+ and d.sign_time is null
|
|
|
+ </if>
|
|
|
+ order by CAST(SUBSTRING_INDEX(o.order_no, '-', -1) AS UNSIGNED) asc,
|
|
|
+ d.address asc, d.arrive_time asc, d.batch_no asc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectPage3" resultType="map">
|
|
|
select distinct o.id, o.order_no, r.direction , v.name, v.credential_no, v.mobile, rm.name AS room_model_name
|
|
|
from trade_order o
|
|
|
@@ -51,4 +104,117 @@
|
|
|
update trade_order_jz_detail set sign_time = null, sign_man = null, sign_remark = null, sign_image = null
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
+
|
|
|
+ <!-- ==================== 赠送行程接站相关 ==================== -->
|
|
|
+
|
|
|
+ <!-- 赠送行程分页查询:基于trade_order_jz_detail,关联trade_detail过滤product_id -->
|
|
|
+ <select id="selectGiftPage"
|
|
|
+ resultType="com.yc.ship.module.trade.dal.dataobject.orderjzdetail.OrderJzDetailDO">
|
|
|
+ select distinct d.* , r.direction , rm.name as room_model_name,
|
|
|
+ SUBSTRING_INDEX(o.order_no, '-', -1) as orderNo, dj.dispatch_no as dispatchNo, dj.group_no as groupNo
|
|
|
+ from trade_order_jz_detail d
|
|
|
+ inner join trade_order_jz oz on d.jz_id = oz.id
|
|
|
+ inner join trade_order o on o.deleted = 0 and o.id = oz.order_id
|
|
|
+ inner join product_voyage v on o.voyage_id = v.id
|
|
|
+ inner join resource_route r on v.route_id = r.id
|
|
|
+ inner join trade_visitor u on u.credential_no = d.id_card and u.order_id = oz.order_id
|
|
|
+ left join resource_room_model rm on u.room_model_id = rm.id
|
|
|
+ left join trade_order_jz_dispatch dj on d.dispatch_id = dj.id
|
|
|
+ inner join trade_detail td on td.order_id = o.id and td.product_id = 2034458675435925505
|
|
|
+ where d.deleted = 0 and o.voyage_id = #{vo.voyageId}
|
|
|
+ <if test="vo.idCard != null">
|
|
|
+ and d.id_card like concat('%', #{vo.idCard}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.name != null">
|
|
|
+ and d.name like concat('%', #{vo.name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.address != null">
|
|
|
+ and d.address = #{vo.address}
|
|
|
+ </if>
|
|
|
+ <if test="vo.arriveTime != null">
|
|
|
+ and d.arrive_time = #{vo.arriveTime}
|
|
|
+ </if>
|
|
|
+ <if test="vo.dispatchNo != null and vo.dispatchNo != ''">
|
|
|
+ and dj.dispatch_no like concat('%', #{vo.dispatchNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 1">
|
|
|
+ and d.sign_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 0">
|
|
|
+ and d.sign_time is null
|
|
|
+ </if>
|
|
|
+ <if test="vo.orderNo != null and vo.orderNo != ''">
|
|
|
+ and o.order_no like concat('%', #{vo.orderNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.otaId != null and vo.otaId != ''">
|
|
|
+ and o.source_id = #{vo.otaId}
|
|
|
+ </if>
|
|
|
+ order by CAST(SUBSTRING_INDEX(o.order_no, '-', -1) AS UNSIGNED) asc,
|
|
|
+ d.address asc, d.arrive_time asc, d.batch_no asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 赠送行程导出查询:条件与selectGiftPage一致,不分页 -->
|
|
|
+ <select id="selectGiftExportList"
|
|
|
+ resultType="com.yc.ship.module.trade.dal.dataobject.orderjzdetail.OrderJzDetailDO">
|
|
|
+ select distinct d.* , r.direction , rm.name as room_model_name,
|
|
|
+ SUBSTRING_INDEX(o.order_no, '-', -1) as orderNo, dj.dispatch_no as dispatchNo, dj.group_no as groupNo
|
|
|
+ from trade_order_jz_detail d
|
|
|
+ inner join trade_order_jz oz on d.jz_id = oz.id
|
|
|
+ inner join trade_order o on o.deleted = 0 and o.id = oz.order_id
|
|
|
+ inner join product_voyage v on o.voyage_id = v.id
|
|
|
+ inner join resource_route r on v.route_id = r.id
|
|
|
+ inner join trade_visitor u on u.credential_no = d.id_card and u.order_id = oz.order_id
|
|
|
+ left join resource_room_model rm on u.room_model_id = rm.id
|
|
|
+ left join trade_order_jz_dispatch dj on d.dispatch_id = dj.id
|
|
|
+ inner join trade_detail td on td.order_id = o.id and td.product_id = 2034458675435925505
|
|
|
+ where d.deleted = 0 and o.voyage_id = #{vo.voyageId}
|
|
|
+ <if test="vo.idCard != null and vo.idCard != ''">
|
|
|
+ and d.id_card like concat('%', #{vo.idCard}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.name != null and vo.name != ''">
|
|
|
+ and d.name like concat('%', #{vo.name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.address != null and vo.address != ''">
|
|
|
+ and d.address = #{vo.address}
|
|
|
+ </if>
|
|
|
+ <if test="vo.arriveTime != null and vo.arriveTime != ''">
|
|
|
+ and d.arrive_time = #{vo.arriveTime}
|
|
|
+ </if>
|
|
|
+ <if test="vo.dispatchNo != null and vo.dispatchNo != ''">
|
|
|
+ and dj.dispatch_no like concat('%', #{vo.dispatchNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 1">
|
|
|
+ and d.sign_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="vo.signStatus != null and vo.signStatus == 0">
|
|
|
+ and d.sign_time is null
|
|
|
+ </if>
|
|
|
+ <if test="vo.orderNo != null and vo.orderNo != ''">
|
|
|
+ and o.order_no like concat('%', #{vo.orderNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.otaId != null and vo.otaId != ''">
|
|
|
+ and o.source_id = #{vo.otaId}
|
|
|
+ </if>
|
|
|
+ order by CAST(SUBSTRING_INDEX(o.order_no, '-', -1) AS UNSIGNED) asc,
|
|
|
+ d.address asc, d.arrive_time asc, d.batch_no asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 赠送行程补登订单查询:根据订单号/证件号后4位搜索,关联trade_detail过滤product_id -->
|
|
|
+ <select id="selectGiftOrderPage" resultType="map">
|
|
|
+ select distinct o.id, o.order_no, r.direction , v.name, v.credential_no, v.mobile, rm.name AS room_model_name
|
|
|
+ from trade_order o
|
|
|
+ inner join product_voyage p on o.voyage_id = p.id
|
|
|
+ inner join resource_route r on p.route_id = r.id
|
|
|
+ inner join trade_visitor v on o.id = v.order_id
|
|
|
+ inner join resource_room_model rm ON v.room_model_id = rm.id
|
|
|
+ inner join trade_detail td on td.order_id = o.id and td.product_id = 2034458675435925505
|
|
|
+ where o.deleted = 0 and p.deleted = 0 and r.deleted = 0 and v.deleted = 0
|
|
|
+ and o.voyage_id = #{vo.voyageId}
|
|
|
+ <if test="vo.queryCode != null">
|
|
|
+ and (v.credential_no like concat('%', #{vo.queryCode}, '%') or v.mobile like concat('%', #{vo.queryCode}, '%') or o.order_no like concat('%', #{vo.queryCode}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="vo.otaId != null and vo.otaId != ''">
|
|
|
+ and o.source_id = #{vo.otaId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|