Commit 170f7ee6 by Java-金吉宝

重复记录

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