Commit 18c2ff27 by Java-金吉宝

重复记录

parent 1d43b2c7
<?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.contact.dao.SoundRecordingDao">
<select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b,
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
<where>
ac.end_status !='INIT'
<if test="seatList.size() > 0">
and (ac.create_by in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
or
ap.user_id in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
)
</if>
<if test="callNo != null and callNo != ''">
AND ac.create_phone LIKE
<if test="dbName == 'oracle'">'%'||#{callNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callNo}, '%')</if>
</if>
<if test="callName != null and callName != ''">
AND ac.create_name LIKE
<if test="dbName == 'oracle'">'%'||#{callName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callName}, '%')</if>
</if>
<if test="acceptNo != null and acceptNo != ''">
AND ap.phone LIKE
<if test="dbName == 'oracle'">'%'||#{acceptNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
</if>
<if test="acceptName != null and acceptName != ''">
AND ap.username LIKE
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
</if>
<if test="beginTime != null and beginTime != ''">
AND (ac.start_time BETWEEN #{beginTime} AND #{endTime})
<!-- AND ac.start_time <![CDATA[>]]> #{beginTime} -->
</if>
<if test="endTime != null and endTime != ''">
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
</if>
</where>
group by b
ORDER BY ac.start_time desc
</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.contact.dao.SoundRecordingDao">
<!-- <select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
select *
from (
SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b,
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
<if test="seatList.size() > 0">
and (ac.create_by in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
or
ap.user_id in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
)
</if>
<if test="callNo != null and callNo != ''">
AND ac.create_phone LIKE
<if test="dbName == 'oracle'">'%'||#{callNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callNo}, '%')</if>
</if>
<if test="callName != null and callName != ''">
AND ac.create_name LIKE
<if test="dbName == 'oracle'">'%'||#{callName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callName}, '%')</if>
</if>
<if test="acceptNo != null and acceptNo != ''">
AND ap.phone LIKE
<if test="dbName == 'oracle'">'%'||#{acceptNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
</if>
<if test='acceptName != null and acceptName != ""'>
AND ap.username LIKE
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
</if>
<if test='beginTime != null and beginTime != ""'>
AND ac.start_time <![CDATA[<=]]>#{endTime} and ac.start_time <![CDATA[>=]]> #{beginTime}
AND ac.start_time <![CDATA[>]]> #{beginTime}
</if>
<if test='endTime != null and endTime != ""'>
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
</if>
GROUP BY b
) er
ORDER BY beginTime DESC
</select> -->
<select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
<if test="seatList.size() > 0">
and (ac.create_by in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
or
ap.user_id in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
)
</if>
<if test="callNo != null and callNo != ''">
AND ac.create_phone LIKE
<if test="dbName == 'oracle'">'%'||#{callNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callNo}, '%')</if>
</if>
<if test="callName != null and callName != ''">
AND ac.create_name LIKE
<if test="dbName == 'oracle'">'%'||#{callName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callName}, '%')</if>
</if>
<if test="acceptNo != null and acceptNo != ''">
AND ap.phone LIKE
<if test="dbName == 'oracle'">'%'||#{acceptNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
</if>
<if test='acceptName != null and acceptName != ""'>
AND ap.username LIKE
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
</if>
<if test='beginTime != null and beginTime != ""'>
AND ac.start_time <![CDATA[<=]]>#{endTime} and ac.start_time <![CDATA[>=]]> #{beginTime}
AND ac.start_time <![CDATA[>]]> #{beginTime}
</if>
<if test='endTime != null and endTime != ""'>
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
</if>
ORDER BY beginTime DESC
</select>
<select id="findRecordingList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
and ac.create_name=#{callName}
and ap.username=#{acceptName}
and ac.start_time=#{endTime}
</select>
</mapper>
\ No newline at end of file
package com.ejweb.modules.contact.dao;
import com.ejweb.core.persistence.CrudDao;
import com.ejweb.core.persistence.annotation.MyBatisDao;
import com.ejweb.modules.contact.entity.SoundRecordingEntity;
@MyBatisDao
public interface SoundRecordingDao extends CrudDao<SoundRecordingEntity> {
}
package com.ejweb.modules.contact.dao;
import java.util.List;
import com.ejweb.core.persistence.CrudDao;
import com.ejweb.core.persistence.annotation.MyBatisDao;
import com.ejweb.modules.contact.entity.SoundRecordingEntity;
@MyBatisDao
public interface SoundRecordingDao extends CrudDao<SoundRecordingEntity> {
List<SoundRecordingEntity> findRecordingList(SoundRecordingEntity entityTmp);
}
package com.ejweb.modules.contact.service;
import com.alibaba.fastjson.JSON;
import com.ejweb.core.fetcher.HttpClientUtil;
import com.ejweb.core.persistence.Page;
import com.ejweb.core.service.CrudService;
import com.ejweb.core.utils.StringUtils;
import com.ejweb.modules.contact.dao.SoundRecordingDao;
import com.ejweb.modules.contact.entity.SoundRecordingEntity;
import com.ejweb.modules.contact.entity.SoundRecordingResponseEntity;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 聊天记录Service
* @author lyw
*
*/
@Service
public class SoundRecordingService extends CrudService<SoundRecordingDao, SoundRecordingEntity> {
@Value("${foc.sound.records.url}")
private String soundRecordingUrl;
public Page<SoundRecordingEntity> getPage(Page<SoundRecordingEntity> page,SoundRecordingEntity soundRecordingEntity) {
soundRecordingEntity.setPage(page);
String url = soundRecordingUrl;
Map<String, String> params = new HashMap<>();
params.put("pageNo", String.valueOf(soundRecordingEntity.getPage().getPageNo()));
params.put("pageSize", String.valueOf(soundRecordingEntity.getPage().getPageSize()));
if (StringUtils.isNotBlank(soundRecordingEntity.getBeginTime())) {
params.put("beginTime", soundRecordingEntity.getBeginTime());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getEndTime())) {
params.put("endTime", soundRecordingEntity.getEndTime());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getCallName())) {
params.put("callUserName", soundRecordingEntity.getCallName());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getAcceptName())) {
params.put("acceptUserName", soundRecordingEntity.getAcceptName());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getCallUserNo())) {
params.put("callUserNo", soundRecordingEntity.getCallUserNo());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getAcceptUserNo())) {
params.put("acceptUserNo", soundRecordingEntity.getAcceptUserNo());
}
String res = HttpClientUtil.doPost(url, params, "UTF-8");
HashMap returnResult = JSON.parseObject(res, HashMap.class);
// Page<SoundRecordingEntity> pageReturnResult = new Page<>();
if ("2000".equals(returnResult.get("status"))) {
SoundRecordingResponseEntity responseEntity = JSON.parseObject(returnResult.get("data").toString(), SoundRecordingResponseEntity.class);
if (responseEntity != null) {
page.setCount(responseEntity.getCount());
page.setList(responseEntity.getList());
page.setPageNo(responseEntity.getPageNo());
page.setPageSize(responseEntity.getPageSize());
}
}
System.out.print(res);
return page;
}
}
package com.ejweb.modules.contact.service;
import com.alibaba.fastjson.JSON;
import com.ejweb.core.fetcher.HttpClientUtil;
import com.ejweb.core.persistence.Page;
import com.ejweb.core.service.CrudService;
import com.ejweb.core.utils.StringUtils;
import com.ejweb.modules.contact.dao.SoundRecordingDao;
import com.ejweb.modules.contact.entity.SoundRecordingEntity;
import com.ejweb.modules.contact.entity.SoundRecordingResponseEntity;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 聊天记录Service
* @author lyw
*
*/
@Service
public class SoundRecordingService extends CrudService<SoundRecordingDao, SoundRecordingEntity> {
@Value("${foc.sound.records.url}")
private String soundRecordingUrl;
public Page<SoundRecordingEntity> getPage(Page<SoundRecordingEntity> page,SoundRecordingEntity soundRecordingEntity) {
soundRecordingEntity.setPage(page);
String url = soundRecordingUrl;
Map<String, String> params = new HashMap<>();
params.put("pageNo", String.valueOf(soundRecordingEntity.getPage().getPageNo()));
params.put("pageSize", String.valueOf(soundRecordingEntity.getPage().getPageSize()));
if (StringUtils.isNotBlank(soundRecordingEntity.getBeginTime())) {
params.put("beginTime", soundRecordingEntity.getBeginTime());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getEndTime())) {
params.put("endTime", soundRecordingEntity.getEndTime());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getCallName())) {
params.put("callUserName", soundRecordingEntity.getCallName());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getAcceptName())) {
params.put("acceptUserName", soundRecordingEntity.getAcceptName());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getCallUserNo())) {
params.put("callUserNo", soundRecordingEntity.getCallUserNo());
}
if (StringUtils.isNotBlank(soundRecordingEntity.getAcceptUserNo())) {
params.put("acceptUserNo", soundRecordingEntity.getAcceptUserNo());
}
String res = HttpClientUtil.doPost(url, params, "UTF-8");
HashMap returnResult = JSON.parseObject(res, HashMap.class);
// Page<SoundRecordingEntity> pageReturnResult = new Page<>();
if ("2000".equals(returnResult.get("status"))) {
SoundRecordingResponseEntity responseEntity = JSON.parseObject(returnResult.get("data").toString(), SoundRecordingResponseEntity.class);
if (responseEntity != null) {
page.setCount(responseEntity.getCount());
page.setList(responseEntity.getList());
page.setPageNo(responseEntity.getPageNo());
page.setPageSize(responseEntity.getPageSize());
}
}
System.out.print(res);
return page;
}
public List<SoundRecordingEntity> findRecordingList(SoundRecordingEntity entityTmp) {
// TODO Auto-generated method stub
return dao.findRecordingList(entityTmp);
}
}
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