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

294 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.mapper.ZdyHotelHomestayHourRoomMapper">
<resultMap type="ZdyHotelHomestayHourRoom" id="ZdyHotelHomestayHourRoomResult">
<result property="id" column="id"/>
<result property="hotelHomestayId" column="hotel_homestay_id"/>
<result property="hotelHomestayRoomClassifyId" column="hotel_homestay_room_classify_id"/>
<result property="duration" column="duration"/>
<result property="price" column="price"/>
<result property="cancelRuleType" column="cancel_rule_type"/>
<result property="cancelRuleContent" column="cancel_rule_content"/>
<result property="delFlag" column="del_flag"/>
<result property="deptId" column="dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap type="com.zhwl.hotel.homestay.domain.vo.ZdyHotelHomestayHourRoomVO"
id="ZdyHotelHomestayHourRoomVOResult">
<result property="id" column="id"/>
<result property="hotelHomestayId" column="hotel_homestay_id"/>
<result property="hotelHomestayRoomClassifyId" column="hotel_homestay_room_classify_id"/>
<result property="duration" column="duration"/>
<result property="price" column="price"/>
<result property="cancelRuleType" column="cancel_rule_type"/>
<result property="cancelRuleContent" column="cancel_rule_content"/>
<result property="delFlag" column="del_flag"/>
<result property="deptId" column="dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="level1Name" column="level1_name"/>
<result property="level2Name" column="level2_name"/>
</resultMap>
<sql id="selectZdyHotelHomestayHourRoomVo">
select id,
hotel_homestay_id,
hotel_homestay_room_classify_id,
duration,
price,
cancel_rule_type,
cancel_rule_content,
del_flag,
dept_id,
create_by,
create_time,
update_by,
update_time,
remark
from zdy_hotel_homestay_hour_room hr
</sql>
<select id="selectZdyHotelHomestayHourRoomList" parameterType="ZdyHotelHomestayHourRoom"
resultMap="ZdyHotelHomestayHourRoomVOResult">
select
hr.id,
hr.hotel_homestay_id,
hr.hotel_homestay_room_classify_id,
hr.duration,
hr.price,
hr.cancel_rule_type,
hr.cancel_rule_content,
hr.del_flag,
hr.dept_id,
hr.create_by,
hr.create_time,
hr.update_by,
hr.update_time,
hr.remark,
rc.level1_name,
rc.level2_name
from zdy_hotel_homestay_hour_room hr
left join zdy_hotel_homestay_room_classify rc
on hr.dept_id = rc.dept_id
and hr.hotel_homestay_id = rc.hotel_homestay_id
and hr.hotel_homestay_room_classify_id = rc.id
<where>
and hr.del_flag = '0'
<if test="hotelHomestayId != null ">
and hr.hotel_homestay_id = #{hotelHomestayId}
</if>
<if test="hotelHomestayRoomClassifyId != null ">
and hr.hotel_homestay_room_classify_id = #{hotelHomestayRoomClassifyId}
</if>
<if test="duration != null ">
and hr.duration = #{duration}
</if>
<if test="price != null ">
and hr.price = #{price}
</if>
<if test="cancelRuleType != null ">
and hr.cancel_rule_type = #{cancelRuleType}
</if>
<if test="cancelRuleContent != null and cancelRuleContent != ''">
and hr.cancel_rule_content = #{cancelRuleContent}
</if>
<if test="deptId != null ">
and hr.dept_id = #{deptId}
</if>
${params.dataScope}
</where>
order by hr.create_time desc
</select>
<select id="selectZdyHotelHomestayHourRoomById" parameterType="Long"
resultMap="ZdyHotelHomestayHourRoomResult">
<include refid="selectZdyHotelHomestayHourRoomVo"/>
where hr.id = #{id} and hr.del_flag = '0'
</select>
<insert id="insertZdyHotelHomestayHourRoom" parameterType="ZdyHotelHomestayHourRoom" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_hotel_homestay_hour_room
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hotelHomestayId != null">hotel_homestay_id,
</if>
<if test="hotelHomestayRoomClassifyId != null">hotel_homestay_room_classify_id,
</if>
<if test="duration != null">duration,
</if>
<if test="price != null">price,
</if>
<if test="cancelRuleType != null">cancel_rule_type,
</if>
<if test="cancelRuleContent != null">cancel_rule_content,
</if>
<if test="delFlag != null and delFlag != ''">del_flag,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hotelHomestayId != null">#{hotelHomestayId},
</if>
<if test="hotelHomestayRoomClassifyId != null">#{hotelHomestayRoomClassifyId},
</if>
<if test="duration != null">#{duration},
</if>
<if test="price != null">#{price},
</if>
<if test="cancelRuleType != null">#{cancelRuleType},
</if>
<if test="cancelRuleContent != null">#{cancelRuleContent},
</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyHotelHomestayHourRoom" parameterType="ZdyHotelHomestayHourRoom">
update zdy_hotel_homestay_hour_room
<trim prefix="SET" suffixOverrides=",">
<if test="hotelHomestayId != null">hotel_homestay_id =
#{hotelHomestayId},
</if>
<if test="hotelHomestayRoomClassifyId != null">hotel_homestay_room_classify_id =
#{hotelHomestayRoomClassifyId},
</if>
<if test="duration != null">duration =
#{duration},
</if>
<if test="price != null">price =
#{price},
</if>
<if test="cancelRuleType != null">cancel_rule_type =
#{cancelRuleType},
</if>
<if test="cancelRuleContent != null">cancel_rule_content =
#{cancelRuleContent},
</if>
<if test="delFlag != null and delFlag != ''">del_flag =
#{delFlag},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyHotelHomestayHourRoomById" parameterType="Long">
delete
from zdy_hotel_homestay_hour_room
where id = #{id}
</delete>
<delete id="deleteZdyHotelHomestayHourRoomByIds" parameterType="String">
update zdy_hotel_homestay_hour_room set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkRoomClassifyIdUnique" resultMap="ZdyHotelHomestayHourRoomResult">
select id, hotel_homestay_room_classify_id
from zdy_hotel_homestay_hour_room
where del_flag = '0'
and hotel_homestay_id = #{hotelHomestayId}
and hotel_homestay_room_classify_id = #{hotelHomestayRoomClassifyId} limit 1
</select>
<select id="selectByHotelHomestayIdAndRoomClassifyId" resultMap="ZdyHotelHomestayHourRoomResult">
select id,
hotel_homestay_id,
hotel_homestay_room_classify_id,
duration,
price,
cancel_rule_type,
cancel_rule_content
from zdy_hotel_homestay_hour_room
where del_flag = '0'
and hotel_homestay_id = #{hotelHomestayId}
and hotel_homestay_room_classify_id = #{roomClassifyId} limit 1
</select>
<select id="selectByHotelHomestayId" parameterType="long" resultMap="ZdyHotelHomestayHourRoomResult">
select id,
hotel_homestay_id,
hotel_homestay_room_classify_id,
duration,
price,
cancel_rule_type,
cancel_rule_content
from zdy_hotel_homestay_hour_room
where del_flag = '0'
and hotel_homestay_id = #{hotelHomestayId}
</select>
<select id="selectByRoomClassifyId" parameterType="long" resultMap="ZdyHotelHomestayHourRoomResult">
select id,
hotel_homestay_id,
hotel_homestay_room_classify_id,
duration,
price,
cancel_rule_type,
cancel_rule_content
from zdy_hotel_homestay_hour_room
where del_flag = '0'
and hotel_homestay_room_classify_id = #{roomClassifyId} limit 1
</select>
<delete id="deleteByHotelHomestayIds" parameterType="long">
update zdy_hotel_homestay_hour_room set del_flag = '1' where hotel_homestay_id in
<foreach item="hotelHomestayId" collection="hotelHomestayIds" open="(" separator="," close=")">
#{hotelHomestayId}
</foreach>
</delete>
</mapper>