Commit 170f7ee6 by Java-金吉宝

重复记录

parent 781dcd7e
<?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.ejweb.modules.call.dao.CallDao">
<!-- 通话主记录 -->
<insert id="createCallRecord">
INSERT INTO foc_call_records(
id,
app_code,
platform,
version_name,
channel_type,
call_type,
user_count,
end_status,
create_by,
create_name,
create_phone,
create_show_phone,
phone_type,
start_time,
end_time,
download_url,
duration
) VALUE (
#{id},
#{appCode},
#{platform},
#{versionName},
#{channelType},
#{callType},
#{userCount},
#{endStatus},
#{createBy},
#{createName},
#{createPhone},
#{createShowPhone},
#{phoneType},
#{startTime},
#{endTime},
#{downloadUrl},
#{duration}
)
</insert>
<select id="getNameByPhone" resultType="java.lang.String">
<![CDATA[
SELECT name
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getIdByPhone" resultType="java.lang.String">
<![CDATA[
SELECT id
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getNameByPhoneFromSeat" resultType="java.lang.String">
<![CDATA[
SELECT seat_name as name
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getIdByPhoneFromSeat" resultType="java.lang.String">
<![CDATA[
SELECT id
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<!-- 添加电话号码记录 -->
<insert id="addCallPhoneList">
INSERT INTO foc_call_phones(
id,
record_id,
title,
user_id,
username,
phone,
show_phone,
phone_type,
flow,
download_url,
center_records_id
) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},
#{item.recordId},
#{item.title},
#{item.userId},
#{item.username},
#{item.phone},
#{item.showPhone},
#{item.phoneType},
#{item.flow},
#{item.downloadUrl},
#{item.centerRecordsId}
)
</foreach>
</insert>
<update id="updateCallRecord">
UPDATE foc_call_records SET end_status=#{endStatus}, end_time=#{endTime} WHERE id=#{id}
</update>
<!-- 获取通话记录列表 -->
<select id="getCallRecordList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
SELECT
CONCAT(r.create_name,p.username,(UNIX_TIMESTAMP(r.end_time)-r.duration)) as b,
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND r.end_status !='INIT'
group by b
ORDER BY r.start_time DESC
</select>
<!-- 通过通话的电话号查询用户信息 -->
<select id="findUserByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.id AS userId,
a.name,
a.email,
a.phone,
a.mobile,
a.photo,
a.huawei_num,
a.full_office_name AS officeFullName,
c.name AS companyName,
o.name AS officeName,
p.duty_name,
p.sex,
a.mobile_nubmer,
a.mobile_province,
a.mobile_city,
a.mobile_sp,
'USER' AS type,
'USER' AS fromType
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
LEFT JOIN sys_user_profiles p
ON a.id = p.user_id
WHERE (a.phone = #{phoneNumer} AND a.huawei_unicall = 1)
OR a.huawei_num = #{phoneNumer}
OR a.mobile = #{phoneNumer}
OR a.mobile_nubmer = #{phoneNumer}
OR a.mobile_nubmer = #{mobileNubmer0}
OR a.mobile_nubmer = #{mobileNubmer00}
OR (a.phone_number = #{phoneNumer} AND a.huawei_unicall = 1)
ORDER BY a.login_date DESC
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select id="findSeatListByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS seatId,
s.id AS userId,
t.station_name,
st.type_name,
s.seat_name,
s.seat_name AS name,
s.seat_phone,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'SEAT' AS fromType
FROM foc_seats s
LEFT JOIN foc_seat_type st
ON s.seat_type=st.id
LEFT JOIN foc_station t
ON st.station_id=t.id
WHERE s.huawei_num = #{phoneNumer}
OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer}
</select>
<select id="findUserInfoByNumOrId" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type
FROM foc_seats s
WHERE s.huawei_num = #{phoneNumer}
OR s.id = #{userId}
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type
FROM sys_user a
WHERE a.huawei_num = #{phoneNumer}
OR a.id = #{userId}
LIMIT 1
</select>
<!-- 通过通话记录获取来电人信息 -->
<select id="findUserByCallRecord" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.`id`,
a.`create_name` AS name,
a.`create_phone`,
a.create_by AS userId,
a.create_by AS seatId,
IF(u.id, 'USER', 'SEAT') AS type,
IF(u.id, u.phone_number, s.seat_phone_number) AS phone_number,
IF(u.id, u.photo, su.photo) AS photo,
s.seat_name,
a.`start_time`,
'RECORD' AS fromType
FROM `foc_sound_records` a
LEFT JOIN sys_user u
ON a.create_by=u.id
LEFT JOIN foc_seats s
ON a.create_by=s.id
LEFT JOIN sys_user su
ON s.login_id=su.id
WHERE a.`start_time` BETWEEN #{startTime} AND #{endTime}
AND a.end_status !='INIT'
HAVING phone_number=#{phoneNumer} OR create_phone= #{phoneNumer}
ORDER BY start_time DESC
LIMIT 1
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select id="getPhoneAreaByAreaCode" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
</select>
<!-- 通过手机查询 -->
<select id="getPhoneAreaByMobile" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area_records` a
WHERE a.mobile=#{mobile}
OR a.mobile_nubmer=#{mobileNubmer0}
OR a.mobile_nubmer=#{mobileNubmer00}
OR a.mobile_nubmer=#{mobileNubmer000}
ORDER BY update_date DESC
LIMIT 1
</select>
<!-- 添加查询记录 -->
<insert id="addPhoneAreaCode">
INSERT INTO foc_phone_area(
area_code,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type
) VALUE (
#{areaCode},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type}
)
ON DUPLICATE KEY UPDATE premobile=VALUES(premobile),
mobile_province=VALUES(mobile_province),
mobile_city=VALUES(mobile_city)
</insert>
<!-- 添加查询记录 -->
<insert id="addPhoneAreaRecord">
INSERT INTO foc_phone_area_records(
id,
mobile,
mobile_nubmer,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type,
update_date
) VALUE (
#{id},
#{mobile},
#{mobileNubmer},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type},
#{updateDate}
)
</insert>
<!-- 添加安科的录音记录 -->
<insert id="addSoundRecord">
INSERT INTO foc_callcenter_records(
id,
call_no,
accept_no,
begin_time,
end_time,
result,
duration,
download_url,
download_size,
current,
current_time_millis,
channel_type,
call_record_id,
foc_begin_time,
foc_end_time,
foc_time_millis,
foc_diff_millis,
create_date
) VALUE (
#{id},
#{callNo},
#{acceptNo},
#{beginTime},
#{endTime},
#{result},
#{duration},
#{downloadUrl},
#{downloadSize},
#{current},
#{currentTimeMillis},
#{channelType},
#{callRecordId},
#{focBeginTime},
#{focEndTime},
#{focTimeMillis},
#{focDiffMillis},
#{createDate}
)
</insert>
<!-- 安科记录 -->
<select id="getCallSoundList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
SELECT *
FROM (
SELECT
CONCAT(r.create_name,p.username,(UNIX_TIMESTAMP(r.end_time)-r.duration)) as b,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
r.create_by AS userId,
r.create_name AS username,
r.create_phone AS phone,
CONCAT('由', r.create_name, '发起电话会议') AS title,
'CALLING' AS flow,
u.photo AS userPhoto,
u.photo AS createByPhoto
FROM foc_sound_records r
LEFT JOIN sys_user u
ON r.create_by = u.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND r.end_status !='INIT'
AND r.create_by=#{userId}
AND r.call_type='GROUP'
group by b
ORDER BY r.start_time DESC
UNION
SELECT
CONCAT(r.create_name,p.username,(UNIX_TIMESTAMP(r.end_time)-r.duration)) as b,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND p.phone_type != 'HWNUBMER'
AND r.end_status !='INIT'
AND r.call_type='USER'
group by b
ORDER BY r.start_time DESC
) t
ORDER BY t.start_time DESC
</select>
<!-- 通过华为号码查询用户信息 -->
<select id="findPhneListByHuaweiNum" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'' AS mobile
FROM foc_seats s
WHERE s.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type,
a.mobile
FROM sys_user a
WHERE a.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="GetPhoneById" resultType="String">
SELECT
CASE WHEN phone_number is not null AND LENGTH(phone_number) >0 THEN phone_number
WHEN mobile is not null AND LENGTH(mobile) >0 THEN mobile
END mobile
FROM sys_user u
WHERE id=#{userId}
UNION
SELECT seat_phone_number FROM foc_seats s
WHERE id=#{userId}
limit 1
</select>
<select id="getMemberList" resultType="com.ejweb.modules.call.entity.MemberEntity">
SELECT p.user_id AS userCode,p.username,p.phone,
IFNULL(s.photo,u.photo) AS userPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u on p.user_id=u.id
LEFT JOIN foc_seats s on p.user_id=s.id
WHERE p.record_id=#{recordId}
</select>
<?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.ejweb.modules.call.dao.CallDao">
<!-- 通话主记录 -->
<insert id="createCallRecord">
INSERT INTO foc_call_records(
id,
app_code,
platform,
version_name,
channel_type,
call_type,
user_count,
end_status,
create_by,
create_name,
create_phone,
create_show_phone,
phone_type,
start_time,
end_time,
download_url,
duration
) VALUE (
#{id},
#{appCode},
#{platform},
#{versionName},
#{channelType},
#{callType},
#{userCount},
#{endStatus},
#{createBy},
#{createName},
#{createPhone},
#{createShowPhone},
#{phoneType},
#{startTime},
#{endTime},
#{downloadUrl},
#{duration}
)
</insert>
<select id="getNameByPhone" resultType="java.lang.String">
<![CDATA[
SELECT name
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getIdByPhone" resultType="java.lang.String">
<![CDATA[
SELECT id
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getNameByPhoneFromSeat" resultType="java.lang.String">
<![CDATA[
SELECT seat_name as name
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select id="getIdByPhoneFromSeat" resultType="java.lang.String">
<![CDATA[
SELECT id
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<!-- 添加电话号码记录 -->
<insert id="addCallPhoneList">
INSERT INTO foc_call_phones(
id,
record_id,
title,
user_id,
username,
phone,
show_phone,
phone_type,
flow,
download_url,
center_records_id
) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},
#{item.recordId},
#{item.title},
#{item.userId},
#{item.username},
#{item.phone},
#{item.showPhone},
#{item.phoneType},
#{item.flow},
#{item.downloadUrl},
#{item.centerRecordsId}
)
</foreach>
</insert>
<update id="updateCallRecord">
UPDATE foc_call_records SET end_status=#{endStatus}, end_time=#{endTime} WHERE id=#{id}
</update>
<!-- 获取通话记录列表 -->
<select id="getCallRecordList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND r.end_status !='INIT'
ORDER BY r.start_time DESC
</select>
<!-- 查重 -->
<select id="get" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.end_status !='INIT'
and r.create_name = #{createName}
and p.username = #{username}
and r.start_time = #{endTime}
</select>
<!-- 通过通话的电话号查询用户信息 -->
<select id="findUserByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.id AS userId,
a.name,
a.email,
a.phone,
a.mobile,
a.photo,
a.huawei_num,
a.full_office_name AS officeFullName,
c.name AS companyName,
o.name AS officeName,
p.duty_name,
p.sex,
a.mobile_nubmer,
a.mobile_province,
a.mobile_city,
a.mobile_sp,
'USER' AS type,
'USER' AS fromType
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
LEFT JOIN sys_user_profiles p
ON a.id = p.user_id
WHERE (a.phone = #{phoneNumer} AND a.huawei_unicall = 1)
OR a.huawei_num = #{phoneNumer}
OR a.mobile = #{phoneNumer}
OR a.mobile_nubmer = #{phoneNumer}
OR a.mobile_nubmer = #{mobileNubmer0}
OR a.mobile_nubmer = #{mobileNubmer00}
OR (a.phone_number = #{phoneNumer} AND a.huawei_unicall = 1)
ORDER BY a.login_date DESC
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select id="findSeatListByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS seatId,
s.id AS userId,
t.station_name,
st.type_name,
s.seat_name,
s.seat_name AS name,
s.seat_phone,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'SEAT' AS fromType
FROM foc_seats s
LEFT JOIN foc_seat_type st
ON s.seat_type=st.id
LEFT JOIN foc_station t
ON st.station_id=t.id
WHERE s.huawei_num = #{phoneNumer}
OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer}
</select>
<select id="findUserInfoByNumOrId" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type
FROM foc_seats s
WHERE s.huawei_num = #{phoneNumer}
OR s.id = #{userId}
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type
FROM sys_user a
WHERE a.huawei_num = #{phoneNumer}
OR a.id = #{userId}
LIMIT 1
</select>
<!-- 通过通话记录获取来电人信息 -->
<select id="findUserByCallRecord" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.`id`,
a.`create_name` AS name,
a.`create_phone`,
a.create_by AS userId,
a.create_by AS seatId,
IF(u.id, 'USER', 'SEAT') AS type,
IF(u.id, u.phone_number, s.seat_phone_number) AS phone_number,
IF(u.id, u.photo, su.photo) AS photo,
s.seat_name,
a.`start_time`,
'RECORD' AS fromType
FROM `foc_sound_records` a
LEFT JOIN sys_user u
ON a.create_by=u.id
LEFT JOIN foc_seats s
ON a.create_by=s.id
LEFT JOIN sys_user su
ON s.login_id=su.id
WHERE a.`start_time` BETWEEN #{startTime} AND #{endTime}
AND a.end_status !='INIT'
HAVING phone_number=#{phoneNumer} OR create_phone= #{phoneNumer}
ORDER BY start_time DESC
LIMIT 1
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select id="getPhoneAreaByAreaCode" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
</select>
<!-- 通过手机查询 -->
<select id="getPhoneAreaByMobile" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area_records` a
WHERE a.mobile=#{mobile}
OR a.mobile_nubmer=#{mobileNubmer0}
OR a.mobile_nubmer=#{mobileNubmer00}
OR a.mobile_nubmer=#{mobileNubmer000}
ORDER BY update_date DESC
LIMIT 1
</select>
<!-- 添加查询记录 -->
<insert id="addPhoneAreaCode">
INSERT INTO foc_phone_area(
area_code,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type
) VALUE (
#{areaCode},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type}
)
ON DUPLICATE KEY UPDATE premobile=VALUES(premobile),
mobile_province=VALUES(mobile_province),
mobile_city=VALUES(mobile_city)
</insert>
<!-- 添加查询记录 -->
<insert id="addPhoneAreaRecord">
INSERT INTO foc_phone_area_records(
id,
mobile,
mobile_nubmer,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type,
update_date
) VALUE (
#{id},
#{mobile},
#{mobileNubmer},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type},
#{updateDate}
)
</insert>
<!-- 添加安科的录音记录 -->
<insert id="addSoundRecord">
INSERT INTO foc_callcenter_records(
id,
call_no,
accept_no,
begin_time,
end_time,
result,
duration,
download_url,
download_size,
current,
current_time_millis,
channel_type,
call_record_id,
foc_begin_time,
foc_end_time,
foc_time_millis,
foc_diff_millis,
create_date
) VALUE (
#{id},
#{callNo},
#{acceptNo},
#{beginTime},
#{endTime},
#{result},
#{duration},
#{downloadUrl},
#{downloadSize},
#{current},
#{currentTimeMillis},
#{channelType},
#{callRecordId},
#{focBeginTime},
#{focEndTime},
#{focTimeMillis},
#{focDiffMillis},
#{createDate}
)
</insert>
<!-- 安科记录 -->
<select id="getCallSoundList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
SELECT *
FROM (
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
r.create_by AS userId,
r.create_name AS username,
r.create_phone AS phone,
CONCAT('由', r.create_name, '发起电话会议') AS title,
'CALLING' AS flow,
u.photo AS userPhoto,
u.photo AS createByPhoto
FROM foc_sound_records r
LEFT JOIN sys_user u
ON r.create_by = u.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND r.end_status !='INIT'
AND r.create_by=#{userId}
AND r.call_type='GROUP'
ORDER BY r.start_time DESC
UNION
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND p.phone_type != 'HWNUBMER'
AND r.end_status !='INIT'
AND r.call_type='USER'
ORDER BY r.start_time DESC
) t
ORDER BY t.start_time DESC
</select>
<!-- 通过华为号码查询用户信息 -->
<select id="findPhneListByHuaweiNum" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'' AS mobile
FROM foc_seats s
WHERE s.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type,
a.mobile
FROM sys_user a
WHERE a.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="GetPhoneById" resultType="String">
SELECT
CASE WHEN phone_number is not null AND LENGTH(phone_number) >0 THEN phone_number
WHEN mobile is not null AND LENGTH(mobile) >0 THEN mobile
END mobile
FROM sys_user u
WHERE id=#{userId}
UNION
SELECT seat_phone_number FROM foc_seats s
WHERE id=#{userId}
limit 1
</select>
<select id="getMemberList" resultType="com.ejweb.modules.call.entity.MemberEntity">
SELECT p.user_id AS userCode,p.username,p.phone,
IFNULL(s.photo,u.photo) AS userPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u on p.user_id=u.id
LEFT JOIN foc_seats s on p.user_id=s.id
WHERE p.record_id=#{recordId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment