FansDao.xml
1.6 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
<?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.FansDao">
<select id="getFansList" resultType="com.w1hd.zzhnc.vo.Fans_Vo">
select a.*,b.nickName as parentfans,c.name as salesname from fans a
LEFT JOIN fans b on a.parentFansId=b.id
LEFT JOIN sales c on a.salesId=c.id
<where>
<if test="keyword !=null and keyword!='' ">
and (a.nickname like CONCAT(CONCAT('%',#{keyword}),'%')
or b.nickname like
CONCAT(CONCAT('%',#{keyword}),'%')
or c.name like
CONCAT(CONCAT('%',#{keyword}),'%'))
</if>
</where>
order by a.createdTime desc
limit #{0},#{1}
</select>
<select id="getFansCount" resultType="java.lang.Integer">
select count(a.id) from fans a
LEFT JOIN fans b on a.parentFansId=b.id
LEFT JOIN sales c on a.salesId=c.id
<where>
<if test="keyword !=null and keyword!='' ">
and (a.nickname like CONCAT(CONCAT('%',#{keyword}),'%')
or b.nickname like
CONCAT(CONCAT('%',#{keyword}),'%')
or c.name like
CONCAT(CONCAT('%',#{keyword}),'%'))
</if>
</where>
</select>
<select id="getFansListForChat" resultType="com.w1hd.zzhnc.vo.ChatLog_DistinctFansIdVO">
select id as fansid,case when remark_name is null or remark_name='' then nickname else remark_name end as nickname,logo,salesId,case when readed then 0 else 1 end as num,last_ask_time as askTime,last_ask_msg as ask,'' as reply,2 as replyType
from fans
where salesId=#{salesid} and last_ask_time is not null
order by last_ask_time desc
limit #{0},#{1}
</select>
</mapper>