SecretReportHistoryMapper.xml
5.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?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="cn.fw.valhalla.dao.mapper.SecretReportHistoryMapper">
<select
id="secretReportList"
resultType="cn.fw.valhalla.domain.dto.SecretReportHistoryDTO"
parameterType="cn.fw.valhalla.domain.query.SecretReportHistoryQuery"
>
SELECT t1.id,
t1.task_id task_id,
t1.task_type follow_type,
t1.follow_record_id follow_record_id,
t1.first_call first_call,
t1.call_id call_id,
t1.staff_id staff_id,
t1.staff_name staff_name,
t1.customer_id customer_id,
t1.customer_id customer_id,
if(t1.task_type=3 , t4.name, t3.name) customer_name,
if(t1.task_type=3 , t4.plate_no, t2.plate_no) plate_no,
t1.call_type dial_type,
t1.call_time call_time,
t1.call_duration call_duration,
t1.shop_id shop_id,
t1.group_id group_id
FROM secret_report_history t1
left join customer t2 on t1.customer_id = t2.id
left join customer_base_info t3 on t2.base_id = t3.id
left join accident_pool t4 on t1.customer_id = t4.id
<where>
<if test="condition.groupId !=null">
and t1.group_id = #{condition.groupId}
</if>
<if test="condition.userId !=null">
and t1.staff_id = #{condition.userId}
</if>
<if test="condition.userName !=null and condition.userName != ''">
and t1.staff_name like concat('%', #{condition.userName}, '%')
</if>
<if test="condition.plateNo != null and condition.plateNo !=''">
and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
</if>
<if test="condition.customerName != null and condition.customerName !=''">
and (t3.name like concat('%', #{condition.customerName}, '%') or t4.name like concat('%', #{condition.customerName}, '%'))
</if>
<if test="condition.shopIds !=null">
and t1.shop_id in
<foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="condition.taskType !=null">
and t1.task_type = #{condition.taskType}
</if>
<if test="condition.startTime1 !=null">
and t1.call_time >= #{condition.startTime1}
</if>
<if test="condition.startTime2 !=null">
and t1.call_time <= #{condition.startTime2}
</if>
</where>
<if test="condition.orderString != null and condition.orderString !='' ">
${condition.orderString}
</if>
limit #{startIndex},#{pageSize};
</select>
<select
id="secretReportCount"
resultType="java.lang.Long"
parameterType="cn.fw.valhalla.domain.query.SecretReportHistoryQuery"
>
SELECT count(t1.id)
FROM secret_report_history t1
left join customer t2 on t1.customer_id = t2.id
left join customer_base_info t3 on t2.base_id = t3.id
left join accident_pool t4 on t1.customer_id = t4.id
<where>
<if test="condition.groupId !=null">
and t1.group_id = #{condition.groupId}
</if>
<if test="condition.userId !=null">
and t1.staff_id = #{condition.userId}
</if>
<if test="condition.userName !=null and condition.userName != ''">
and t1.staff_name like concat('%', #{condition.userName}, '%')
</if>
<if test="condition.plateNo != null and condition.plateNo !=''">
and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
</if>
<if test="condition.customerName != null and condition.customerName !=''">
and (t3.name like concat('%', #{condition.customerName}, '%') or t4.name like concat('%', #{condition.customerName}, '%'))
</if>
<if test="condition.shopIds !=null">
and t1.shop_id in
<foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="condition.taskType !=null">
and t1.task_type = #{condition.taskType}
</if>
<if test="condition.startTime1 !=null">
and t1.call_time >= #{condition.startTime1}
</if>
<if test="condition.startTime2 !=null">
and t1.call_time <= #{condition.startTime2}
</if>
</where>
</select>
</mapper>