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

231 lines
14 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.routine.mapper.RtFuReservationMapper">
<resultMap type="RtFuReservation" id="RtFuReservationResult">
<result property="id" column="id" />
<result property="reNo" column="re_no" />
<result property="roNo" column="ro_no" />
<result property="roomName" column="room_name" />
<result property="rtTheme" column="rt_theme" />
<result property="rtRole" column="rt_role" />
<result property="rtPeople" column="rt_people" />
<result property="rtPurpose" column="rt_purpose" />
<result property="rtTime" column="rt_Time" />
<result property="rtYuyue" column="rt_yuyue" />
<result property="rtState" column="rt_state" />
<result property="rtImgs" column="rt_imgs" />
<result property="rtCreattime" column="rt_creatTime" />
<result property="rtUptime" column="rt_upTime" />
<result property="rtCreatRole" column="rt_creat_role" />
<result property="rtDepar" column="rt_depar" />
</resultMap>
<sql id="selectRtFuReservationVo">
SELECT id,re_no,ro_no,room_name,rt_theme,rt_role,rt_people,rt_purpose,rt_Time,rt_state,rt_imgs,rt_creatTime,rt_creat_role,rt_depar,create_time,depart,update_time
FROM rt_fu_reservation
</sql>
<select id="selectRtFuReservationListinfo" parameterType="RtFuReservation" resultMap="RtFuReservationResult">
<include refid="selectRtFuReservationVo"/>
<where>
<if test="reNo != null and reNo != ''"> and re_no = #{reNo}</if>
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
</where>
</select>
<select id="selectRtFuReservationList" parameterType="RtFuReservation" resultMap="RtFuReservationResult">
SELECT id,re_no,ro_no,room_name,rt_theme,rt_role,rt_people,rt_purpose,rt_Time,rt_yuyue,rt_state,rt_creatTime,rt_upTime,rt_creat_role,rt_depar
FROM rt_fu_reservation
<where>
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
<if test="roNo != null and roNo != ''"> and ro_no = #{roNo}</if>
<if test="rtTheme != null and rtTheme != ''"> and rt_theme = #{rtTheme}</if>
<if test="rtRole != null and rtRole != ''"> and rt_role = #{rtRole}</if>
<if test="rtPeople != null and rtPeople != ''"> and rt_people = #{rtPeople}</if>
<if test="rtPurpose != null and rtPurpose != ''"> and rt_purpose = #{rtPurpose}</if>
<if test="rtTime != null and rtTime != ''"> and rt_Time = #{rtTime}</if>
<if test="rtYuyue != null "> and rt_yuyue = #{rtYuyue}</if>
<if test="rtState != null "> and rt_state = #{rtState}</if>
<if test="rtImgs != null and rtImgs != ''"> and rt_imgs = #{rtImgs}</if>
<if test="rtCreattime != null "> and rt_creatTime = #{rtCreattime}</if>
<if test="rtCreatRole != null and rtCreatRole != ''"> and rt_creat_role = #{rtCreatRole}</if>
<if test="rtDepar != null and rtDepar != ''"> and rt_depar = #{rtDepar}</if>
<if test="auStatus != null and Auditor != ''"> and au_status = #{auStatus}</if>
<if test="Auditor != null and Auditor != ''"> and auditor = #{Auditor}</if>
<if test="CreateTime != null and CreateTime != ''"> and create_time = #{CreateTime}</if>
<if test="upDateTime != null and upDateTime != ''"> and update_time = #{upDateTime}</if>
<if test="Depart != null and Depart != ''"> and depart = #{Depart}</if>
<if test="Reason != null and Reason != ''"> and reason = #{Reason}</if>
</where>
ORDER BY rt_creatTime DESC
</select>
<select id="selectRtFuReservationLists" resultType="com.srs.routine.domain.vo.RtFuReservationVo">
SELECT a.id,a.re_no,a.ro_no,a.room_name,rt_theme,rt_role,rt_people,rt_purpose,rt_Time,rt_yuyue,rt_state,rt_creatTime,rt_upTime,rt_creat_role,rt_depar,b.au_status,res_name,res_path
FROM rt_fu_reservation as a left join rt_fu_audit as b on a.re_no=b.re_no left join rt_fu_resource as res on res.res_main_no=a.re_no
<where>
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
<if test="rtTheme != null and rtTheme != ''"> and rt_theme = #{rtTheme}</if>
<if test="rtRole != null and rtRole != ''"> and rt_role = #{rtRole}</if>
<if test="rtPeople != null and rtPeople != ''"> and rt_people = #{rtPeople}</if>
<if test="rtPurpose != null and rtPurpose != ''"> and rt_purpose = #{rtPurpose}</if>
<if test="rtTime != null and rtTime != ''"> and rt_Time = #{rtTime}</if>
<if test="rtYuyue != null "> and rt_yuyue = #{rtYuyue}</if>
<if test="rtState != null "> and rt_state = #{rtState}</if>
<if test="rtImgs != null and rtImgs != ''"> and rt_imgs = #{rtImgs}</if>
<if test="rtCreattime != null "> and rt_creatTime = #{rtCreattime}</if>
<if test="rtCreatRole != null and rtCreatRole != ''"> and rt_creat_role = #{rtCreatRole}</if>
<if test="rtDepar != null and rtDepar != ''"> and rt_depar = #{rtDepar}</if>
<if test="auStatus != null and Auditor != ''"> and au_status = #{auStatus}</if>
<if test="Auditor != null and Auditor != ''"> and auditor = #{Auditor}</if>
</where>
ORDER BY rt_creatTime DESC
</select>
<!-- 查询当前功能房的日期下的时间段是否预约-->
<select id="seleectRtFuYuyue" resultType="rtFuReservation">
SELECT *
FROM rt_fu_reservation rt_fu_solt as b on c.weekday=b.ro_weekday
<!-- <where>-->
<!-- <if test="roNo != null and roNo != ''"> and ro_no = #{roNo}</if>-->
<!-- <if test="rtTime != null "> and rt_Time = #{rtTime}</if>-->
<!-- <if test="rtYuyue != null and rtYuyue != ''"> and rt_yuyue = #{rtYuyue}</if>-->
<!-- </where>-->
where ro_no = #{roNo} and rt_Time = #{rtTime} and rt_yuyue = #{rtYuyue}
</select>
<!-- 预约详情-->
<select id="selectRtFuReservationById" parameterType="Long" resultType="com.srs.routine.domain.vo.RtFuResIdVo">
SELECT re.id,re_no,ro_no,room_name,rt_theme,rt_role,rt_people,rt_purpose,rt_Time,rt_yuyue,rt_state,rt_creatTime,rt_upTime,rt_creat_role,rt_depar,ro_startTime,ro_endTime
FROM rt_fu_reservation as re left join rt_fu_solt as so on re.rt_yuyue=so.ro_type
where re.id=#{id}
</select>
<select id="getroTimeinfo" parameterType="string" resultType="com.srs.routine.domain.vo.RtfuRoTimeVo">
SELECT distinct ro_no,re_no,room_name,rt_Time,rt_yuyue,rt_creat_role,s.nick_name
FROM rt_fu_reservation as a left join sys_user as s on a.rt_creat_role=s.user_name
where ro_no=#{roNo} and rt_Time>= CURDATE() - INTERVAL 17 DAY
ORDER BY rt_Time ASC
</select>
<!-- 预约详情-->
<select id="selectRtFuReservationByuser" resultType="com.srs.routine.domain.vo.RtFuReservationVo">
SELECT id,re_no,ro_no,room_name,rt_theme,rt_role,rt_people,rt_purpose,rt_Time,rt_yuyue,rt_state,rt_creatTime,rt_upTime,rt_creat_role,rt_depar
FROM rt_fu_reservation
<where>
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
<if test="rtCreatRole != null and rtCreatRole != ''"> and rt_creat_role = #{rtCreatRole}</if>
</where>
</select>
<select id="selectRtFuReservationinfo" parameterType="string" resultMap="RtFuReservationResult">
select distinct * from rt_fu_reservation
where ro_no=#{ro_no}
</select>
<select id="selectRtFuReservationinfos" parameterType="string" resultMap="RtFuReservationResult">
select distinct * from rt_fu_reservation
where re_no=#{re_no}
</select>
<!-- 预约详情(好像没用到)-->
<select id="selectRtFuReservationByRoNo" parameterType="string" resultMap="RtFuReservationResult">
SELECT distinct c.ro_no,a.room_name,a.room_matter,room_rule,room_info,a.room_purp,status,room_capacity,room_createTime,room_user,room_depar,c.rt_yuyue,c.rt_Time,ro_weekday,ro_weekTime FROM rt_fu_room as a left join
(SELECT *,CASE WEEKDAY(rt_Time)WHEN 0 THEN '星期一'WHEN 1 THEN '星期二'WHEN 2 THEN '星期三'WHEN 3 THEN '星期四'WHEN 4 THEN '星期五' WHEN 5 THEN '星期六'WHEN 6 THEN '星期日'END AS weekday FROM rt_fu_reservation)as c on a.ro_no=c.ro_no left join
rt_fu_solt as b on c.weekday=b.ro_weekday
where a.ro_no=#{ro_no}
</select>
<!-- 查询活动室预约情况-->
<select id="seleectRtFuTime" resultType="rtFuReservation">
SELECT DISTINCT * from rt_fu_reservation
where ro_no=#{ro_no} and DATE(rt_Time) = #{rt_Time}
</select>
<!-- 查询活动室使用情况-->
<select id="seletRtfuCase" resultType="rtFuReservation">
SELECT b.ro_no,b.room_name,rt_Time,rt_yuyue,rt_state,rt_creat_role,rt_depar FROM rt_fu_room as a left join rt_fu_reservation as b on a.ro_no=b.ro_no
where b.ro_no=#{ro_no} and DATE(rt_Time) = #{rt_Time}
</select>
<!-- 导出数据的查询-->
<select id="getexportrtfu" resultType="com.srs.routine.domain.dto.RtFureservationDto">
SELECT re.id,re.room_name,rt_creat_role,rt_depar,rt_Time,ro_startTime,ro_endTime,rt_role,rt_people,rt_purpose,rt_theme,res_name,res_path
FROM rt_fu_reservation as re left join rt_fu_solt as so on re.rt_yuyue=so.ro_type left join rt_fu_resource as res on re.re_no=res.res_main_no
</select>
<insert id="insertRtFuReservation" parameterType="RtFuReservation" useGeneratedKeys="true" keyProperty="id">
insert into rt_fu_reservation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="reNo != null">re_no,</if>
<if test="roNo != null">ro_no,</if>
<if test="roomName != null">room_name,</if>
<if test="rtTheme != null">rt_theme,</if>
<if test="rtRole != null">rt_role,</if>
<if test="rtPeople != null">rt_people,</if>
<if test="rtPurpose != null">rt_purpose,</if>
<if test="rtTime != null">rt_Time,</if>
<if test="rtYuyue != null">rt_yuyue,</if>
<if test="rtState != null">rt_state,</if>
<if test="rtImgs != null">rt_imgs,</if>
<if test="rtCreattime != null">rt_creatTime,</if>
<if test="rtUptime != null">rt_upTime,</if>
<if test="rtCreatRole != null">rt_creat_role,</if>
<if test="rtDepar != null">rt_depar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reNo != null">#{reNo},</if>
<if test="roNo != null">#{roNo},</if>
<if test="roomName != null">#{roomName},</if>
<if test="rtTheme != null">#{rtTheme},</if>
<if test="rtRole != null">#{rtRole},</if>
<if test="rtPeople != null">#{rtPeople},</if>
<if test="rtPurpose != null">#{rtPurpose},</if>
<if test="rtTime != null">#{rtTime},</if>
<if test="rtYuyue != null">#{rtYuyue},</if>
<if test="rtState != null">#{rtState},</if>
<if test="rtImgs != null">#{rtImgs},</if>
<if test="rtCreattime != null">#{rtCreattime},</if>
<if test="rtUptime != null">#{rtUptime},</if>
<if test="rtCreatRole != null">#{rtCreatRole},</if>
<if test="rtDepar != null">#{rtDepar},</if>
</trim>
</insert>
<update id="updateRtFuReservation" parameterType="RtFuReservation">
update rt_fu_reservation
<trim prefix="SET" suffixOverrides=",">
<if test="reNo != null">re_no = #{reNo},</if>
<if test="roNo != null">ro_no = #{roNo},</if>
<if test="roomName != null">room_name = #{roomName},</if>
<if test="rtTheme != null">rt_theme = #{rtTheme},</if>
<if test="rtRole != null">rt_role = #{rtRole},</if>
<if test="rtPeople != null">rt_people = #{rtPeople},</if>
<if test="rtPurpose != null">rt_purpose = #{rtPurpose},</if>
<if test="rtTime != null">rt_Time = #{rtTime},</if>
<if test="rtYuyue != null">rt_yuyue = #{rtYuyue},</if>
<if test="rtState != null">rt_state = #{rtState},</if>
<if test="rtImgs != null">rt_imgs = #{rtImgs},</if>
<if test="rtCreattime != null">rt_creatTime = #{rtCreattime},</if>
<if test="rtUptime != null">rt_upTime = #{rtUptime},</if>
<if test="rtCreatRole != null">rt_creat_role = #{rtCreatRole},</if>
<if test="rtDepar != null">rt_depar = #{rtDepar},</if>
</trim>
where re_no = #{reNo}
</update>
<delete id="deleteRtFuReservationByreNo" parameterType="String">
delete from rt_fu_reservation where re_no = #{reNo}
</delete>
<delete id="deleteRtFuReservationByIds" parameterType="String">
delete from rt_fu_reservation where id in
<foreach item="a.id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>