Browse Source

Data

master
laishajiang 2 years ago
parent
commit
ab24962994
  1. 62
      mailbox-lan/src/main/resources/mapper/DataMapper.xml

62
mailbox-lan/src/main/resources/mapper/DataMapper.xml

@ -64,58 +64,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getFirstAllList" resultType="java.util.Map" >
SELECT *, (CAST(REPLACE(crate, '%', '') AS NUMERIC) * 0.5 +
CAST(REPLACE(srate, '%', '') AS NUMERIC) * 0.3 +
CAST(REPLACE(rate, '%', '') AS NUMERIC) * 0.2) AS score,'长沙市公安局' as cname FROM
(
(
select
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) crateNumber,
CONCAT(ROUND(SUM(COALESCE(b.completed, 0))*100 / NULLIF(COUNT(1), 0),0),'%') AS cRate,
SUM(COALESCE(b.completed, 0)) AS completed,
COUNT(1) AS cSum,
(SELECT COUNT(*) FROM mail_mark b where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>) AS total
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
CAST(REPLACE(srate, '%', '') AS NUMERIC) * 0.3 +
CAST(REPLACE(rate, '%', '') AS NUMERIC) * 0.2) AS score,'长沙市公安局' as cname FROM
(
(
select
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) crateNumber,
CONCAT(ROUND(SUM(COALESCE(b.completed, 0))*100 / NULLIF(COUNT(1), 0),0),'%') AS cRate,
SUM(COALESCE(b.completed, 0)) AS completed,
COUNT(1) AS cSum,
(SELECT COUNT(*) FROM mail_mark b where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>) AS total
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>
) t1
join
) t1
join
(
select CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END),0),'%') Rate,
SUM(COALESCE(b.resolved, 0)) resolved,SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END) rSum,
(
select CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END),0),'%') Rate,
SUM(COALESCE(b.resolved, 0)) resolved,SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END) rSum,
(SELECT COUNT(*) FROM mail_mark b where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>) AS total
</if>) AS total2
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>
) t2 on t1.total = t2.total
) t2 on t1.total = t2.total2
) t3 JOIN
) t3 JOIN
(
select
CONCAT(ROUND(SUM(COALESCE(b.satisfied, 0))*100 / NULLIF(SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END), 0),0),'%') AS sRate,
SUM(COALESCE(b.satisfied, 0)) AS satisfied,
SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END) AS Sum,
(
select
CONCAT(ROUND(SUM(COALESCE(b.satisfied, 0))*100 / NULLIF(SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END), 0),0),'%') AS sRate,
SUM(COALESCE(b.satisfied, 0)) AS satisfied,
SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END) AS Sum,
(SELECT COUNT(*) FROM mail_mark b where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>) AS total
</if>) AS total3
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
from mail_mark b left join dept a on a.id=b.second_dept_id where 1=1
<if test="searchStartTime != null and searchEndTime != null">
AND b.completion_time BETWEEN #{searchStartTime} AND (to_date(#{searchEndTime}) + interval '1 D')
</if>
) t4 on t3.total = t4.total
) t4 on t3.total2 = t4.total3
</select>

Loading…
Cancel
Save