|
|
|
|
@ -45,28 +45,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectQueryPage" resultType="com.biutag.lan.domain.vo.QueryMailVo"> |
|
|
|
|
-- select distinct m.contact_name,m.contact_phone,m.contact_id_card,m.contact_sex,m.content,m.source,m.mail_time,m.id,m.mail_state, |
|
|
|
|
-- m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name,m.current_operator, |
|
|
|
|
-- f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time |
|
|
|
|
-- from mail m |
|
|
|
|
-- left join work w on m.id = w.mail_id |
|
|
|
|
-- left join flow_node f on m.flow_key = f.key |
|
|
|
|
SELECT DISTINCT |
|
|
|
|
m.*,f.limited_time - ROUND(extract(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) AS flow_limited_remaining_time |
|
|
|
|
FROM |
|
|
|
|
(SELECT |
|
|
|
|
COALESCE(a.contact_name, ms.contact_name) AS contact_name,COALESCE(a.contact_phone, ms.contact_phone) AS contact_phone, |
|
|
|
|
COALESCE(a.contact_id_card, ms.contact_id_card) AS contact_id_card,COALESCE(a.contact_sex, ms.contact_sex) AS contact_sex, |
|
|
|
|
COALESCE(a.content, ms.content) AS content,COALESCE(a.source, ms.source) AS source, |
|
|
|
|
COALESCE(a.mail_time, ms.mail_time) AS mail_time,COALESCE(a.id, ms.id) AS id, |
|
|
|
|
a.mail_state,a.mail_category,a.mail_level,a.three_dept_id,a.three_dept_name,a.flow_key,a.flow_before_name, |
|
|
|
|
a.mail_labels,a.flow_name,a.current_operator,a.flow_limited_last_handler_time,a.second_dept_id,a.mail_first_category, |
|
|
|
|
a.mail_second_category,a.mail_three_category |
|
|
|
|
FROM |
|
|
|
|
mail_source ms |
|
|
|
|
LEFT JOIN mail a ON ms.id = a.id |
|
|
|
|
) AS m |
|
|
|
|
<choose> |
|
|
|
|
<when test="countMails != null"> |
|
|
|
|
m.contact_name,m.contact_phone,m.contact_id_card,m.contact_sex,m.content,m.source,m.mail_time,m.id,m.mail_state, |
|
|
|
|
m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name,m.current_operator, |
|
|
|
|
m.flow_limited_last_handler_time,m.second_dept_id,m.mail_first_category,m.mail_second_category,m.mail_three_category, |
|
|
|
|
f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time |
|
|
|
|
from mail m |
|
|
|
|
</when> |
|
|
|
|
<otherwise> |
|
|
|
|
m.*,f.limited_time - ROUND(extract(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) AS flow_limited_remaining_time |
|
|
|
|
FROM |
|
|
|
|
(SELECT |
|
|
|
|
COALESCE(a.contact_name, ms.contact_name) AS contact_name,COALESCE(a.contact_phone, ms.contact_phone) AS contact_phone, |
|
|
|
|
COALESCE(a.contact_id_card, ms.contact_id_card) AS contact_id_card,COALESCE(a.contact_sex, ms.contact_sex) AS contact_sex, |
|
|
|
|
COALESCE(a.content, ms.content) AS content,COALESCE(a.source, ms.source) AS source, |
|
|
|
|
COALESCE(a.mail_time, ms.mail_time) AS mail_time,COALESCE(a.id, ms.id) AS id, |
|
|
|
|
a.mail_state,a.mail_category,a.mail_level,a.three_dept_id,a.three_dept_name,a.flow_key,a.flow_before_name, |
|
|
|
|
a.mail_labels,a.flow_name,a.current_operator,a.flow_limited_last_handler_time,a.second_dept_id,a.mail_first_category, |
|
|
|
|
a.mail_second_category,a.mail_three_category |
|
|
|
|
FROM |
|
|
|
|
mail_source ms |
|
|
|
|
LEFT JOIN mail a ON ms.id = a.id |
|
|
|
|
) AS m |
|
|
|
|
</otherwise> |
|
|
|
|
</choose> |
|
|
|
|
LEFT JOIN work w ON m.id = w.mail_id |
|
|
|
|
LEFT JOIN mail_mark mm on mm.mail_id = m.id |
|
|
|
|
LEFT JOIN flow_node f ON m.flow_key = f.key |
|
|
|
|
${ew.getCustomSqlSegment} |
|
|
|
|
</select> |
|
|
|
|
|