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

144 lines
5.7 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">
<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" />
</resultMap>
<resultMap id="dtoMap" type="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
<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" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, 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
</sql>
<select id="selectByRoomAndTime" resultMap="dtoMap">
select <include refid="baseColumns"/>
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">
select <include refid="baseColumns"/>,tm.name as roomName
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">
select <include refid="baseColumns"/>,tm.name as roomName
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">
select <include refid="baseColumns"/>
from t_meetingroom_book t
where t.state = 1
and #{date} > t.book_date
</select>
</mapper>