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

193 lines
6.8 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.ZdyHotelHomestayConsumerItemMapper">
<resultMap type="ZdyHotelHomestayConsumerItem" id="ZdyHotelHomestayConsumerItemResult">
<result property="id" column="id"/>
<result property="hotelHomestayId" column="hotel_homestay_id"/>
<result property="deptId" column="dept_id"/>
<result property="type" column="type"/>
<result property="name" column="name"/>
<result property="price" column="price"/>
<result property="status" column="status"/>
<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>
<sql id="selectZdyHotelHomestayConsumerItemVo">
select id,
hotel_homestay_id,
dept_id,
type,
name,
price,
status,
create_by,
create_time,
update_by,
update_time,
remark
from zdy_hotel_homestay_consumer_item ci
</sql>
<select id="selectZdyHotelHomestayConsumerItemList" parameterType="ZdyHotelHomestayConsumerItem"
resultMap="ZdyHotelHomestayConsumerItemResult">
<include refid="selectZdyHotelHomestayConsumerItemVo"/>
<where>
ci.del_flag = '0'
<if test="hotelHomestayId != null ">
and ci.hotel_homestay_id = #{hotelHomestayId}
</if>
<if test="deptId != null ">
and ci.dept_id = #{deptId}
</if>
<if test="type != null ">
and ci.type = #{type}
</if>
<if test="name != null and name != ''">
and ci.name like concat('%', #{name}, '%')
</if>
<if test="price != null ">
and ci.price = #{price}
</if>
<if test="status != null ">
and ci.status = #{status}
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyHotelHomestayConsumerItemById" parameterType="Long"
resultMap="ZdyHotelHomestayConsumerItemResult">
<include refid="selectZdyHotelHomestayConsumerItemVo"/>
where ci.id = #{id} and ci.del_flag = '0'
</select>
<insert id="insertZdyHotelHomestayConsumerItem" parameterType="ZdyHotelHomestayConsumerItem" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_hotel_homestay_consumer_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hotelHomestayId != null">hotel_homestay_id,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="type != null">type,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="price != null">price,
</if>
<if test="status != null">status,
</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="hotelHomestayId != null">#{hotelHomestayId},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="type != null">#{type},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="price != null">#{price},
</if>
<if test="status != null">#{status},
</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="updateZdyHotelHomestayConsumerItem" parameterType="ZdyHotelHomestayConsumerItem">
update zdy_hotel_homestay_consumer_item
<trim prefix="SET" suffixOverrides=",">
<if test="hotelHomestayId != null">hotel_homestay_id =
#{hotelHomestayId},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="price != null">price =
#{price},
</if>
<if test="status != null">status =
#{status},
</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="deleteZdyHotelHomestayConsumerItemById" parameterType="Long">
delete
from zdy_hotel_homestay_consumer_item
where id = #{id}
</delete>
<delete id="deleteZdyHotelHomestayConsumerItemByIds" parameterType="String">
update zdy_hotel_homestay_consumer_item set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkConsumerItemNameUnique" resultMap="ZdyHotelHomestayConsumerItemResult">
<include refid="selectZdyHotelHomestayConsumerItemVo"/>
where
ci.hotel_homestay_id = #{hotelHomestayId}
and ci.type = #{type}
and ci.name = #{name}
and ci.del_flag = '0'
limit 1
</select>
</mapper>