Files
zhxg_java/srs-staff/src/main/resources/mapper/staff/StaffOneStopRoomOpeningHoursMapper.xml
2025-07-28 15:14:11 +08:00

153 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.srs.staff.mapper.StaffOneStopRoomOpeningHoursMapper">
<resultMap type="StaffOneStopRoomOpeningHours" id="StaffOneStopRoomOpeningHoursResult">
<result property="ohId" column="oh_id"/>
<result property="roomNo" column="room_no"/>
<result property="ohWeekday" column="oh_weekday"/>
<result property="openingHours" column="opening_hours"/>
<result property="isOccupy" column="is_occupy"/>
<result property="isDel" column="is_del"/>
<result property="rtNo" column="rt_no"/>
</resultMap>
<sql id="selectStaffOneStopRoomOpeningHoursVo">
select oh_id, room_no, oh_weekday, opening_hours, is_occupy, is_del, rt_no
from staff_one_stop_room_opening_hours
</sql>
<select id="selectStaffOneStopRoomOpeningHoursList" parameterType="StaffOneStopRoomOpeningHours"
resultMap="StaffOneStopRoomOpeningHoursResult">
<include refid="selectStaffOneStopRoomOpeningHoursVo"/>
<where>
<if test="roomNo != null and roomNo != ''">and room_no = #{roomNo}</if>
<if test="ohWeekday != null and ohWeekday != ''">and oh_weekday = #{ohWeekday}</if>
<if test="openingHours != null and openingHours != ''">and opening_hours = #{openingHours}</if>
<if test="isOccupy != null ">and is_occupy = #{isOccupy}</if>
<if test="rtNo != null and rtNo != ''">and rt_no = #{rtNo}</if>
</where>
</select>
<select id="selectStaffOneStopRoomOpeningHoursByOhId" parameterType="Long"
resultMap="StaffOneStopRoomOpeningHoursResult">
<include refid="selectStaffOneStopRoomOpeningHoursVo"/>
where oh_id = #{ohId}
</select>
<!--根据功能房编号查询-->
<select id="selectStaffOneStopRoomOpeningHoursByRoomNo"
resultMap="StaffOneStopRoomOpeningHoursResult">
<include refid="selectStaffOneStopRoomOpeningHoursVo"/>
where room_no = #{roomNo}
</select>
<!--根据功能房预约记录编号查询-->
<select id="selectStaffOneStopRoomOpeningHoursByRtNo"
resultMap="StaffOneStopRoomOpeningHoursResult">
<include refid="selectStaffOneStopRoomOpeningHoursVo"/>
where rt_no = #{rtNo}
</select>
<!--根据功能房星期几查询-->
<select id="selectStaffOneStopRoomOpeningHoursByOhWeekday" parameterType="String"
resultMap="StaffOneStopRoomOpeningHoursResult">
<include refid="selectStaffOneStopRoomOpeningHoursVo"/>
<where>
<if test="roomNo != null and roomNo != ''">
and room_no = #{roomNo}
</if>
<if test="ohWeekday != null and ohWeekday != ''">
and oh_weekday = #{ohWeekday}
</if>
</where>
</select>
<insert id="insertStaffOneStopRoomOpeningHours" parameterType="StaffOneStopRoomOpeningHours" useGeneratedKeys="true"
keyProperty="ohId">
insert into staff_one_stop_room_opening_hours
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roomNo != null">room_no,</if>
<if test="ohWeekday != null">oh_weekday,</if>
<if test="openingHours != null">opening_hours,</if>
<if test="isOccupy != null">is_occupy,</if>
<if test="isDel != null">is_del,</if>
<if test="rtNo != null">rt_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roomNo != null">#{roomNo},</if>
<if test="ohWeekday != null">#{ohWeekday},</if>
<if test="openingHours != null">#{openingHours},</if>
<if test="isOccupy != null">#{isOccupy},</if>
<if test="isDel != null">#{isDel},</if>
<if test="rtNo != null">#{rtNo},</if>
</trim>
</insert>
<!--批量新增-->
<insert id="insertStaffOneStopRoomOpeningHoursBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
insert into staff_one_stop_room_opening_hours
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.roomNo != null and item.roomNo != ''">room_no,</if>
<if test="item.ohWeekday != null and item.ohWeekday != ''">oh_weekday,</if>
<if test="item.openingHours != null and item.openingHours != ''">opening_hours,</if>
<if test="item.isOccupy != null and item.isOccupy != ''">is_occupy,</if>
<if test="item.isDel != null">is_del,</if>
<if test="item.rtNo != null">rt_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="item.roomNo != null and item.roomNo != ''">#{item.roomNo},</if>
<if test="item.ohWeekday != null and item.ohWeekday != ''">#{item.ohWeekday},</if>
<if test="item.openingHours != null and item.openingHours != ''">#{item.openingHours},</if>
<if test="item.isOccupy != null and item.isOccupy != ''">#{item.isOccupy},</if>
<if test="item.isDel != null">#{item.isDel},</if>
<if test="item.rtNo != null">#{item.rtNo},</if>
</trim>
</foreach>
</insert>
<update id="updateStaffOneStopRoomOpeningHours" parameterType="StaffOneStopRoomOpeningHours">
update staff_one_stop_room_opening_hours
<trim prefix="SET" suffixOverrides=",">
<if test="roomNo != null">room_no = #{roomNo},</if>
<if test="ohWeekday != null">oh_weekday = #{ohWeekday},</if>
<if test="openingHours != null">opening_hours = #{openingHours},</if>
<if test="isOccupy != null">is_occupy = #{isOccupy},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="rtNo != null">rt_no = #{rtNo},</if>
</trim>
where oh_id = #{ohId}
</update>
<!--批量修改-->
<update id="batchUpdateStaffOneStopRoomOpeningHours" parameterType="java.util.List">
<foreach collection="list" item="hours" index="index" separator=";">
update staff_one_stop_room_opening_hours
<set>
<if test="hours.roomNo != null">room_no = #{hours.roomNo},</if>
<if test="hours.ohWeekday != null">oh_weekday = #{hours.ohWeekday},</if>
<if test="hours.openingHours != null">opening_hours = #{hours.openingHours},</if>
<if test="hours.isOccupy != null">is_occupy = #{hours.isOccupy},</if>
<if test="hours.isDel != null">is_del = #{hours.isDel},</if>
<if test="hours.rtNo != null">rt_no = #{hours.rtNo}</if>
</set>
where oh_id = #{hours.ohId}
</foreach>
</update>
<delete id="deleteStaffOneStopRoomOpeningHoursByOhId" parameterType="Long">
delete
from staff_one_stop_room_opening_hours
where oh_id = #{ohId}
</delete>
<delete id="deleteStaffOneStopRoomOpeningHoursByOhIds" parameterType="String">
delete from staff_one_stop_room_opening_hours where oh_id in
<foreach item="ohId" collection="array" open="(" separator="," close=")">
#{ohId}
</foreach>
</delete>
</mapper>