ReceptionBizInfoMapper.xml
9.12 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?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.bs.reception.mapper.ReceptionBizInfoMapper">
<resultMap id="ReceptionBizInfoResult" type="com.bs.reception.entity.reception.ReceptionBizInfo">
<result property="id" column="id" jdbcType="BIGINT"/>
<result property="typeCode" column="type_code" jdbcType="VARCHAR"/>
<result property="storeCode" column="store_code" jdbcType="VARCHAR"/>
<result property="spCode" column="sp_code" jdbcType="VARCHAR"/>
<result property="carType" column="car_type" jdbcType="VARCHAR"/>
<result property="result" column="result" jdbcType="VARCHAR"/>
<result property="customerType" column="customer_type" jdbcType="VARCHAR"/>
<result property="customerName" column="customer_name" jdbcType="VARCHAR"/>
<result property="customerPhone" column="customer_phone" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="materialId" column="material_id" jdbcType="BIGINT"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createById" column="create_by_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateById" column="update_by_id" jdbcType="BIGINT"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="ReceptionManagePageVO" type="com.bs.reception.model.reception.ReceptionManagePageVO">
<result property="id" column="id" jdbcType="BIGINT"/>
<result property="typeCode" column="type_code" jdbcType="VARCHAR"/>
<result property="storeCode" column="store_code" jdbcType="VARCHAR"/>
<result property="storeName" column="store_name" jdbcType="VARCHAR"/>
<result property="spCode" column="sp_code" jdbcType="VARCHAR"/>
<result property="spName" column="sp_name" jdbcType="VARCHAR"/>
<result property="carType" column="car_type" jdbcType="VARCHAR"/>
<result property="result" column="result" jdbcType="VARCHAR"/>
<result property="customerType" column="customer_type" jdbcType="VARCHAR"/>
<result property="customerName" column="customer_name" jdbcType="VARCHAR"/>
<result property="customerPhone" column="customer_phone" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="phoneNumber" column="phone_number" jdbcType="VARCHAR"/>
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="materialId" column="material_id" jdbcType="BIGINT"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createById" column="create_by_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateById" column="update_by_id" jdbcType="BIGINT"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="score" column="score" jdbcType="DECIMAL"/>
<result property="duration" column="duration" jdbcType="BIGINT"/>
<result property="receptionDate" column="receptionDate" jdbcType="TIMESTAMP"/>
<result property="recordUrl" column="recordUrl" jdbcType="VARCHAR"/>
</resultMap>
<sql id="selectReceptionBizInfo">
select id,
type_code,
store_code,
sp_code,
car_type,
result,
customer_type,
customer_name,
customer_phone,
user_id,
user_name,
start_time,
end_time,
material_id,
create_by,
create_by_id,
create_time,
update_by,
update_by_id,
update_time,
remark,
del_flag
from reception_biz_info
</sql>
<select id="findByRecordindId" resultMap="ReceptionBizInfoResult">
select t1.* from reception_biz_info t1
left join reception_recording t2 on t1.id=t2.biz_info_id
where t2.id=#{recordindId}
</select>
<select id="receptionManagePage" resultMap="ReceptionManagePageVO">
SELECT
rbi.*,
rcr.score,
rr.duration,
DATE(rbi.start_time) receptionDate,
rr.url as recordUrl,
su.phone_number,
si.sp_name,
bs.store_name
FROM `reception_biz_info` rbi
LEFT JOIN `reception_recording` rr ON rr.biz_info_id=rbi.id AND rr.del_flag=0
LEFT JOIN `recording_model_call` rmc ON rmc.recording_id=rr.id
LEFT JOIN `recording_check_result` rcr ON rcr.model_call_id=rmc.id AND deleted_flag='N'
LEFT JOIN `sys_user` su ON rbi.user_id = su.user_id
LEFT JOIN `sp_info` si ON rbi.sp_code = si.sp_code
LEFT JOIN `business_store` bs ON rbi.store_code = bs.store_code
WHERE rbi.del_flag=0
<if test="query.spCode != null and query.spCode != ''">
AND rbi.sp_code = #{query.spCode}
</if>
<if test="query.storeCode != null and query.storeCode != ''">
AND rbi.store_code = #{query.storeCode}
</if>
<if test="query.phoneNumber != null and query.phoneNumber != ''">
AND su.phone_number LIKE CONCAT('%',#{query.phoneNumber},'%')
</if>
<if test="query.typeCode != null and query.typeCode != ''">
AND rbi.type_code=#{query.typeCode}
</if>
<if test="query.userName != null and query.userName != ''">
AND rbi.user_name LIKE CONCAT('%',#{query.userName},'%')
</if>
<if test="query.customerName != null and query.customerName != ''">
AND rbi.customer_name LIKE CONCAT('%',#{query.customerName},'%')
</if>
<if test="query.customerPhone != null and query.customerPhone != ''">
AND rbi.customer_phone LIKE CONCAT('%',#{query.customerPhone},'%')
</if>
<if test="query.receptionDateStart != null">
AND rbi.start_time <![CDATA[>=]]> #{query.receptionDateStart}
</if>
<if test="query.receptionDateEnd != null">
AND rbi.start_time <![CDATA[<=]]> #{query.receptionDateEnd}
</if>
<if test="query.qcScoreMin != null">
AND rcr.score <![CDATA[>=]]> #{query.qcScoreMin}
</if>
<if test="query.qcScoreMax != null">
AND rcr.score <![CDATA[<=]]> #{query.qcScoreMax}
</if>
<if test="query.result != null and query.result != ''">
AND rbi.result=#{query.result}
</if>
<!-- 服务商数据权限过滤 -->
<if test="query.params.dataScope != null and query.params.dataScope != ''">
AND ${query.params.dataScope}
</if>
ORDER BY rbi.id DESC
</select>
<select id="getReceptionStatistics" resultType="com.bs.reception.model.reception.ReceptionStatisticsVO">
SELECT
COUNT(DISTINCT rbi.id) AS receptionCount,
AVG(rcr.score) AS avgCheckScore,
AVG(rr.duration) AS avgDuration
FROM `reception_biz_info` rbi
LEFT JOIN `reception_recording` rr ON rr.biz_info_id = rbi.id AND rr.del_flag = 0
LEFT JOIN `recording_model_call` rmc ON rmc.recording_id = rr.id
LEFT JOIN `recording_check_result` rcr ON rcr.model_call_id = rmc.id AND rcr.deleted_flag = 'N'
WHERE rbi.del_flag = 0
<if test="receptionStartTime != null">
AND rbi.start_time <![CDATA[>=]]> #{receptionStartTime}
</if>
<if test="receptionEndTime != null">
AND rbi.start_time <![CDATA[<=]]> #{receptionEndTime}
</if>
<if test="params.dataScope != null and params.dataScope != ''">
AND ${params.dataScope}
</if>
</select>
<select id="getReceptionCount" resultType="java.lang.Long">
SELECT COUNT(rbi.id)
FROM `reception_biz_info` rbi
WHERE rbi.del_flag = 0
<if test="receptionStartTime != null">
AND rbi.start_time <![CDATA[>=]]> #{receptionStartTime}
</if>
<if test="receptionEndTime != null">
AND rbi.start_time <![CDATA[<=]]> #{receptionEndTime}
</if>
<if test="params.dataScope != null and params.dataScope != ''">
AND ${params.dataScope}
</if>
</select>
</mapper>