王佳豪
2021-06-26 718f604deb342b0bee6c588bb44e22ced3371fb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?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.slcf.dao.MeetingDao">
 
<!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
<sql id="meetingConditionSql">    
        <if test="meetingNo!=null and meetingNo!='' ">
            and f_MeetingNo like '%' + #{meetingNo} + '%'
        </if>
        <if test="meetingName!=null and meetingName!='' ">
            and f_MeetingName like '%' + #{meetingName} + '%'
        </if>
        <if test="roomId!=null and roomId!=0 ">
            and u.f_RoomId = #{roomId}
        </if>        
        <if test="MeetingBeginDate!=null and MeetingBeginDate!=''
            and  MeetingEndDate!=null and MeetingEndDate!=''">
            <![CDATA[
            and ((f_MeetingDateTime > #{MeetingBeginDate} and f_MeetingDateTime < #{MeetingEndDate})
            or (f_MeetingEndDate > #{MeetingBeginDate} and f_MeetingEndDate < #{MeetingEndDate}))
            ]]>            
        </if>        
</sql>
 
<select id="getMeetingList" parameterType="com.slcf.bean.MeetingCondition" resultType="com.slcf.pojo.MeetingBean">
select top (#{pageSize}) *  
from tb_meeting u left join tb_meeting_room d  on u.f_RoomId=d.f_RoomId 
<where>
    f_MeetingNo not in (select top ((#{pageNumber}-1)*#{pageSize}) f_MeetingNo from tb_meeting 
    <where>
        1=1
        <include refid="meetingConditionSql"></include>        
    </where>
    order by f_MeetingDateTime desc)
    <include refid="meetingConditionSql"></include>
    <![CDATA[
        order by f_MeetingDateTime desc
    ]]>
</where>
</select>
 
<select id="getCount" parameterType="com.slcf.bean.MeetingCondition"    resultType="Integer">
select count(1) from tb_meeting u left join tb_meeting_room d  on u.f_RoomId=d.f_RoomId  
<where>
<![CDATA[
    1=1
]]>
<include refid="meetingConditionSql"></include>
</where>
</select>
</mapper>