zhwl/zhwl-business/zhwl-hotel-homestay-order/target/classes/mapper/hotelHomestay/ZdyHotelHomestayOrderRoomDetailMapper.xml
2025-07-01 17:54:58 +08:00

263 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.hotel.homestay.order.mapper.ZdyHotelHomestayOrderRoomDetailMapper">
<resultMap type="ZdyHotelHomestayOrderRoomDetail" id="ZdyHotelHomestayOrderRoomDetailResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="roomId" column="room_id"/>
<result property="roomClassifyId" column="room_classify_id"/>
<result property="roomCharge" column="room_charge"/>
<result property="cancelRuleType" column="cancel_rule_type"/>
<result property="cancelRuleContent" column="cancel_rule_content"/>
<result property="roomStatusId" column="room_status_id"/>
<result property="penaltyFee" column="penalty_fee"/>
<result property="payAmount" column="pay_amount"/>
<collection property="stayInfos" javaType="java.util.List" resultMap="StayInfoResult"/>
</resultMap>
<resultMap type="ZdyHotelHomestayOrderStayInfo" id="StayInfoResult">
<result property="id" column="stay_info_id"/>
<result property="orderId" column="stay_info_order_id"/>
<result property="orderRoomDetailId" column="stay_info_order_room_detail_id"/>
<result property="customerId" column="stay_info_customer_id"/>
<result property="mobile" column="stay_info_mobile"/>
<result property="idCard" column="stay_info_id_card"/>
<result property="idCardType" column="stay_info_id_card_type"/>
<result property="name" column="stay_info_name"/>
<result property="processedBy" column="stay_info_processed_by"/>
<result property="processingTime" column="stay_info_processing_time"/>
<result property="idCardFrontPhoto" column="stay_info_id_card_front_photo"/>
<result property="idCardBackPhoto" column="stay_info_id_card_back_photo"/>
<result property="facePhoto" column="stay_info_face_photo"/>
</resultMap>
<sql id="selectZdyHotelHomestayOrderRoomDetailVo">
select id,
order_id,
room_id,
room_classify_id,
room_charge,
cancel_rule_type,
cancel_rule_content,
room_status_id,
penalty_fee,
pay_amount
from zdy_hotel_homestay_order_room_detail
</sql>
<select id="selectZdyHotelHomestayOrderRoomDetailList" parameterType="ZdyHotelHomestayOrderRoomDetail"
resultMap="ZdyHotelHomestayOrderRoomDetailResult">
<include refid="selectZdyHotelHomestayOrderRoomDetailVo"/>
<where>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="roomId != null ">
and room_id = #{roomId}
</if>
<if test="roomClassifyId != null ">
and room_classify_id = #{roomClassifyId}
</if>
<if test="roomCharge != null ">
and room_charge = #{roomCharge}
</if>
</where>
</select>
<select id="selectZdyHotelHomestayOrderRoomDetailById" parameterType="Long"
resultMap="ZdyHotelHomestayOrderRoomDetailResult">
select zhhord.id,
zhhord.order_id,
zhhord.room_id,
zhhord.room_classify_id,
zhhord.room_charge,
zhhord.cancel_rule_type,
zhhord.cancel_rule_content,
zhhord.room_status_id,
zhhord.penalty_fee,
zhhord.pay_amount
from zdy_hotel_homestay_order_room_detail zhhord
where zhhord.id = #{id}
</select>
<insert id="insertZdyHotelHomestayOrderRoomDetail" parameterType="ZdyHotelHomestayOrderRoomDetail"
useGeneratedKeys="true"
keyProperty="id">
insert into zdy_hotel_homestay_order_room_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,
</if>
<if test="roomId != null">room_id,
</if>
<if test="roomClassifyId != null">room_classify_id,
</if>
<if test="roomCharge != null">room_charge,
</if>
<if test="cancelRuleType != null">cancel_rule_type,
</if>
<if test="cancelRuleContent != null">cancel_rule_content,
</if>
<if test="roomStatusId != null">room_status_id,
</if>
<if test="penaltyFee != null">penalty_fee,
</if>
<if test="payAmount != null">pay_amount,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},
</if>
<if test="roomId != null">#{roomId},
</if>
<if test="roomClassifyId != null">#{roomClassifyId},
</if>
<if test="roomCharge != null">#{roomCharge},
</if>
<if test="cancelRuleType != null">#{cancelRuleType},
</if>
<if test="cancelRuleContent != null">#{cancelRuleContent},
</if>
<if test="roomStatusId != null">#{roomStatusId},
</if>
<if test="penaltyFee != null">#{penaltyFee},
</if>
<if test="payAmount != null">#{payAmount},
</if>
</trim>
</insert>
<update id="updateZdyHotelHomestayOrderRoomDetail" parameterType="ZdyHotelHomestayOrderRoomDetail">
update zdy_hotel_homestay_order_room_detail
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="roomId != null">room_id =
#{roomId},
</if>
<if test="roomClassifyId != null">room_classify_id =
#{roomClassifyId},
</if>
<if test="roomCharge != null">room_charge =
#{roomCharge},
</if>
<if test="cancelRuleType != null">cancel_rule_type =
#{cancelRuleType},
</if>
<if test="cancelRuleContent != null">cancel_rule_content =
#{cancelRuleContent},
</if>
<if test="roomStatusId != null">room_status_id =
#{roomStatusId},
</if>
<if test="penaltyFee != null">penalty_fee =
#{penaltyFee},
</if>
<if test="payAmount != null">pay_amount =
#{payAmount},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyHotelHomestayOrderRoomDetailById" parameterType="Long">
delete
from zdy_hotel_homestay_order_room_detail
where id = #{id}
</delete>
<delete id="deleteZdyHotelHomestayOrderRoomDetailByIds" parameterType="String">
delete from zdy_hotel_homestay_order_room_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getByOrderId" parameterType="Long" resultMap="ZdyHotelHomestayOrderRoomDetailResult">
select zhhord.id,
zhhord.order_id,
zhhord.room_id,
zhhord.room_classify_id,
zhhord.room_charge,
zhhord.cancel_rule_type,
zhhord.cancel_rule_content,
zhhord.room_status_id,
zhhord.penalty_fee,
zhhord.pay_amount,
zhhosi.id as stay_info_id,
zhhosi.order_id as stay_info_order_id,
zhhosi.order_room_detail_id as stay_info_order_room_detail_id,
zhhosi.customer_id as stay_info_customer_id,
zhhosi.processed_by as stay_info_processed_by,
zhhosi.processing_time as stay_info_processing_time,
zhhosi.id_card_front_photo as stay_info_id_card_front_photo,
zhhosi.id_card_back_photo as stay_info_id_card_back_photo,
zhhosi.face_photo as stay_info_face_photo,
zhhc.mobile as stay_info_mobile,
zhhc.id_card as stay_info_id_card,
zhhc.id_card_type as stay_info_id_card_type,
zhhc.name as stay_info_name
from zdy_hotel_homestay_order_room_detail zhhord
left join zdy_hotel_homestay_order_stay_info zhhosi on zhhord.id = zhhosi.order_room_detail_id
left join zdy_hotel_homestay_customer zhhc on zhhc.id = zhhosi.customer_id
where zhhord.order_id = #{orderId}
</select>
<select id="listRoomIdsByOrderId" parameterType="Long" resultMap="ZdyHotelHomestayOrderRoomDetailResult">
select id, room_id, room_status_id
from zdy_hotel_homestay_order_room_detail
where order_id = #{orderId}
</select>
<select id="listRoomStatusIdsByOrderId" parameterType="Long" resultType="Long">
select room_status_id
from zdy_hotel_homestay_order_room_detail
where order_id = #{orderId}
</select>
<update id="clearRoomStatusIdByOrderId" parameterType="Long">
update zdy_hotel_homestay_order_room_detail
set room_status_id = null
where order_id = #{orderId}
</update>
<select id="getByRoomStatusId" parameterType="Long" resultMap="ZdyHotelHomestayOrderRoomDetailResult">
select zhhord.id,
zhhord.order_id,
zhhord.room_id,
zhhord.room_classify_id,
zhhord.room_charge,
zhhord.cancel_rule_type,
zhhord.cancel_rule_content,
zhhord.room_status_id,
zhhord.penalty_fee,
zhhord.pay_amount,
zhhosi.id as stay_info_id,
zhhosi.order_id as stay_info_order_id,
zhhosi.order_room_detail_id as stay_info_order_room_detail_id,
zhhosi.customer_id as stay_info_customer_id,
zhhosi.processed_by as stay_info_processed_by,
zhhosi.processing_time as stay_info_processing_time,
zhhosi.id_card_front_photo as stay_info_id_card_front_photo,
zhhosi.id_card_back_photo as stay_info_id_card_back_photo,
zhhosi.face_photo as stay_info_face_photo,
zhhc.mobile as stay_info_mobile,
zhhc.id_card as stay_info_id_card,
zhhc.id_card_type as stay_info_id_card_type,
zhhc.name as stay_info_name
from zdy_hotel_homestay_order_room_detail zhhord
left join zdy_hotel_homestay_order_stay_info zhhosi on zhhord.id = zhhosi.order_room_detail_id
left join zdy_hotel_homestay_customer zhhc on zhhc.id = zhhosi.customer_id
where zhhord.room_status_id = #{roomStatusId}
</select>
<update id="clearRoomStatusIdById" parameterType="Long">
update zdy_hotel_homestay_order_room_detail
set room_status_id = null
where id = #{id}
</update>
</mapper>