share-platform/renren-admin/src/main/resources/mapper/meeting/TMeetingroomBookMapper.xml

152 lines
6.0 KiB
XML
Raw Normal View History

2022-08-11 09:20:29 +08:00
<?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="io.renren.modules.meeting.dao.TMeetingroomBookMapper">
2022-09-29 17:51:37 +08:00
<resultMap id="BaseResultMap" type="io.renren.modules.meeting.entity.TMeetingroomBook">
<result column="id" property="id"/>
<result column="room_id" property="roomId"/>
<result column="book_date" property="bookDate"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="name" property="name"/>
<result column="phone" property="phone"/>
<result column="dept" property="dept"/>
<result column="matter" property="matter"/>
<result column="file" property="file"/>
<result column="create_date" property="createDate"/>
<result column="creator" property="creator"/>
<result column="state" property="state"/>
<result column="audit_viem" property="auditViem"/>
<result column="auditor" property="auditor"/>
<result column="audit_time" property="auditTime"/>
<result column="apply_price" property="applyPrice"/>
2022-09-29 17:51:37 +08:00
</resultMap>
2022-08-11 09:20:29 +08:00
<resultMap id="dtoMap" type="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
2022-09-29 17:51:37 +08:00
<result column="id" property="id"/>
<result column="room_id" property="roomId"/>
2022-08-11 09:20:29 +08:00
<result column="book_date" property="bookDate"/>
2022-09-29 17:51:37 +08:00
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="name" property="name"/>
<result column="phone" property="phone"/>
<result column="dept" property="dept"/>
<result column="matter" property="matter"/>
<result column="file" property="file"/>
<result column="create_date" property="createDate"/>
<result column="creator" property="creator"/>
<result column="state" property="state"/>
<result column="audit_viem" property="auditViem"/>
<result column="auditor" property="auditor"/>
<result column="audit_time" property="auditTime"/>
<result column="apply_price" property="applyPrice"/>
2022-08-11 09:20:29 +08:00
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
2022-09-29 17:51:37 +08:00
t.id
2022-08-11 09:20:29 +08:00
, t.room_id
, t.book_date
, t.start_time
, t.end_time
, t.name
, t.phone
, t.dept
, t.matter
, t.file
, t.create_date
, t.creator
, t.state
, t.audit_viem
, t.auditor
, t.audit_time
, t.apply_price
2022-09-29 17:51:37 +08:00
</sql>
2022-08-11 09:20:29 +08:00
<select id="selectByRoomAndTime" resultMap="dtoMap">
2022-09-29 17:51:37 +08:00
select
<include refid="baseColumns"/>
2022-08-11 09:20:29 +08:00
from t_meetingroom_book t
where t.room_id = #{roomId}
and t.state != 3
<if test="bookDate != 'null 00:00:00'.toString()">
and t.book_date = #{bookDate}
</if>
<if test="startTime.length() == 19 and startTime.substring(11,19) != null
and endTime.length() == 19 and endTime.substring(11,19) != null ">
and t.end_time >= #{startTime} and #{endTime} >= t.start_time
</if>
order by t.start_time asc
</select>
<select id="queryCountByRoomName" resultType="java.lang.Integer">
select count(t.id) from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
where t.creator = #{userId}
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
</select>
<select id="queryList" resultMap="dtoMap">
2022-09-29 17:51:37 +08:00
select<include refid="baseColumns"/>,tm.name as roomName
2022-08-11 09:20:29 +08:00
from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
where t.creator = #{userId}
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
order by t.create_date desc
limit #{currentNum},#{pageSize}
</select>
<select id="queryCountByState" resultType="java.lang.Integer">
select count(t.id) from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
<where>
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
<if test="state != null">
<choose>
<when test="state == 1">
and t.state = #{state}
</when>
<otherwise>
and t.state in (2,3)
</otherwise>
</choose>
</if>
</where>
</select>
<select id="queryListForAudit" resultType="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
2022-09-29 17:51:37 +08:00
select<include refid="baseColumns"/>,tm.name as roomName
2022-08-11 09:20:29 +08:00
from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
<where>
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
<if test="state != null">
<choose>
<when test="state == 1">
and t.state = #{state}
</when>
<otherwise>
and t.state in (2,3)
</otherwise>
</choose>
</if>
</where>
order by t.state asc,t.create_date desc
limit #{currentNum},#{pageSize}
</select>
<select id="selectInvalid" resultMap="BaseResultMap">
2022-09-29 17:51:37 +08:00
select
<include refid="baseColumns"/>
2022-08-11 09:20:29 +08:00
from t_meetingroom_book t
where t.state = 1
2022-09-29 17:51:37 +08:00
and #{date} > t.book_date
2022-08-11 09:20:29 +08:00
</select>
<select id="selectBookIdByRoomId" resultType="java.lang.Long">
SELECT id FROM t_meetingroom_book WHERE room_id = #{id}
</select>
2022-08-11 09:20:29 +08:00
</mapper>