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

86 lines
3.7 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.ZdyHotelHomestayFacilitiesRelationMapper">
<resultMap type="ZdyHotelHomestayFacilitiesRelation" id="ZdyHotelHomestayFacilitiesRelationResult">
<result property="hotelHomestayId" column="hotel_homestay_id"/>
<result property="hotelHomestayFacilitiesId" column="hotel_homestay_facilities_id"/>
</resultMap>
<sql id="selectZdyHotelHomestayFacilitiesRelationVo">
select hotel_homestay_id, hotel_homestay_facilities_id
from zdy_hotel_homestay_facilities_relation
</sql>
<select id="selectZdyHotelHomestayFacilitiesRelationList" parameterType="ZdyHotelHomestayFacilitiesRelation"
resultMap="ZdyHotelHomestayFacilitiesRelationResult">
<include refid="selectZdyHotelHomestayFacilitiesRelationVo"/>
<where>
<if test="hotelHomestayId != null ">
and hotel_homestay_id = #{hotelHomestayId}
</if>
<if test="hotelHomestayFacilitiesId != null ">
and hotel_homestay_facilities_id = #{hotelHomestayFacilitiesId}
</if>
</where>
</select>
<select id="selectByHotelHomestayId" parameterType="Long"
resultMap="ZdyHotelHomestayFacilitiesRelationResult">
<include refid="selectZdyHotelHomestayFacilitiesRelationVo"/>
where hotel_homestay_id = #{hotelHomestayId}
</select>
<insert id="insertZdyHotelHomestayFacilitiesRelation" parameterType="ZdyHotelHomestayFacilitiesRelation">
insert into zdy_hotel_homestay_facilities_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hotelHomestayId != null">hotel_homestay_id,
</if>
<if test="hotelHomestayFacilitiesId != null">hotel_homestay_facilities_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hotelHomestayId != null">#{hotelHomestayId},
</if>
<if test="hotelHomestayFacilitiesId != null">#{hotelHomestayFacilitiesId},
</if>
</trim>
</insert>
<update id="updateZdyHotelHomestayFacilitiesRelation" parameterType="ZdyHotelHomestayFacilitiesRelation">
update zdy_hotel_homestay_facilities_relation
<trim prefix="SET" suffixOverrides=",">
<if test="hotelHomestayFacilitiesId != null">hotel_homestay_facilities_id =
#{hotelHomestayFacilitiesId},
</if>
</trim>
where hotel_homestay_id = #{hotelHomestayId}
</update>
<delete id="deleteByHotelHomestayId" parameterType="Long">
delete
from zdy_hotel_homestay_facilities_relation
where hotel_homestay_id = #{hotelHomestayId}
</delete>
<delete id="deleteZdyHotelHomestayFacilitiesRelationByHotelHomestayIds" parameterType="String">
delete from zdy_hotel_homestay_facilities_relation where hotel_homestay_id in
<foreach item="hotelHomestayId" collection="array" open="(" separator="," close=")">
#{hotelHomestayId}
</foreach>
</delete>
<delete id="deleteByHotelHomestayFacilitiesId" parameterType="long">
delete
from zdy_hotel_homestay_facilities_relation
where hotel_homestay_facilities_id = #{hotelHomestayFacilitiesId}
</delete>
<select id="countByHotelHomestayFacilitiesId" parameterType="long" resultType="int">
select count(1)
from zdy_hotel_homestay_facilities_relation
where hotel_homestay_facilities_id = #{hotelHomestayFacilitiesId}
</select>
</mapper>