RemarksDao.xml
1.3 KB
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
<?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.w1hd.zzhnc.dao.RemarksDao">
<select id="getRemarksList" resultType="com.w1hd.zzhnc.vo.Remarks_Vo">
select a.*,b.nickname,b.logo from remarks a
left join fans b on
a.fansid=b.id
<where>
a.deleted=0
<if test="estateid != null and estateid>0">
and a.estateid=#{estateid}
</if>
<choose>
<when test="fansId != null and fansId > 0">
and (a.fansid= #{fansId} or (a.fansid!= #{fansId}
and status = #{status}))
</when>
<otherwise>
<if test="status != null">
and status = #{status}
</if>
</otherwise>
</choose>
</where>
ORDER BY createdtime desc limit #{0},#{1}
</select>
<select id="getRemarksCount" resultType="java.lang.Integer">
select count(a.id)
from remarks a
left join fans b on a.fansid=b.id
<where>
a.deleted=0
<if test="estateid != null and estateid>0">
and a.estateid=#{estateid}
</if>
<choose>
<when test="fansId != null and fansId > 0">
and (a.fansid= #{fansId} or (a.fansid!= #{fansId}
and status = #{status}))
</when>
<otherwise>
<if test="status != null">
and status = #{status}
</if>
</otherwise>
</choose>
</where>
</select>
</mapper>