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

202 lines
7.3 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.ZdyHotelHomestayFacilitiesMapper">
<resultMap type="ZdyHotelHomestayFacilities" id="ZdyHotelHomestayFacilitiesResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="logo" column="logo"/>
<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="delFlag" column="del_flag"/>
</resultMap>
<resultMap type="ZdyHotelHomestayFacilitiesVO" id="ZdyHotelHomestayFacilitiesVOResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="logo" column="logo"/>
</resultMap>
<sql id="selectZdyHotelHomestayFacilitiesVo">
select id,
name,
type,
logo,
dept_id,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag
from zdy_hotel_homestay_facilities f
</sql>
<select id="selectZdyHotelHomestayFacilitiesList" parameterType="ZdyHotelHomestayFacilities"
resultMap="ZdyHotelHomestayFacilitiesResult">
<include refid="selectZdyHotelHomestayFacilitiesVo"/>
<where>
and f.del_flag = '0'
<if test="name != null and name != ''">
and f.name like concat('%', #{name}, '%')
</if>
<if test="type != null ">
and f.type = #{type}
</if>
<if test="logo != null and logo != ''">
and f.logo = #{logo}
</if>
<if test="deptId != null ">
and f.dept_id = #{deptId}
</if>
${params.dataScope}
</where>
order by f.create_time desc
</select>
<select id="selectZdyHotelHomestayFacilitiesById" parameterType="Long"
resultMap="ZdyHotelHomestayFacilitiesResult">
<include refid="selectZdyHotelHomestayFacilitiesVo"/>
where f.id = #{id} and f.del_flag = '0'
</select>
<select id="selectZdyHotelHomestayFacilitiesByIds" parameterType="Long"
resultMap="ZdyHotelHomestayFacilitiesResult">
<include refid="selectZdyHotelHomestayFacilitiesVo"/>
where f.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
and f.del_flag = '0'
</select>
<insert id="insertZdyHotelHomestayFacilities" parameterType="ZdyHotelHomestayFacilities" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_hotel_homestay_facilities
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,
</if>
<if test="type != null">type,
</if>
<if test="logo != null and logo != ''">logo,
</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>
<if test="delFlag != null">del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null">#{type},
</if>
<if test="logo != null and logo != ''">#{logo},
</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>
<if test="delFlag != null">#{delFlag},
</if>
</trim>
</insert>
<update id="updateZdyHotelHomestayFacilities" parameterType="ZdyHotelHomestayFacilities">
update zdy_hotel_homestay_facilities
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="logo != null and logo != ''">logo =
#{logo},
</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>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyHotelHomestayFacilitiesById" parameterType="Long">
delete
from zdy_hotel_homestay_facilities
where id = #{id}
</delete>
<delete id="deleteZdyHotelHomestayFacilitiesByIds" parameterType="String">
update zdy_hotel_homestay_facilities set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkFacilitiesNameUnique" resultMap="ZdyHotelHomestayFacilitiesResult">
<include refid="selectZdyHotelHomestayFacilitiesVo"/>
where f.del_flag = '0'
and f.dept_id = #{deptId}
and f.name = #{name} limit 1
</select>
<select id="selectByDeptId" parameterType="Long"
resultMap="ZdyHotelHomestayFacilitiesResult">
<include refid="selectZdyHotelHomestayFacilitiesVo"/>
where f.dept_id = #{deptId} and f.del_flag = '0'
</select>
<select id="selectByHotelHomestayId" parameterType="Long"
resultMap="ZdyHotelHomestayFacilitiesVOResult">
select f.id, f.name, f.type, f.logo
from zdy_hotel_homestay_facilities f
left join zdy_hotel_homestay_facilities_relation fr on f.id = fr.hotel_homestay_facilities_id
left join zdy_hotel_homestay h on fr.hotel_homestay_id = h.id
where h.id = #{hotelHomestayId}
</select>
</mapper>