@ -10,7 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.id,contact_name,contact_phone,a.create_time ,b.name mail_state from mail a
select a.id,contact_name,contact_phone,a.create_time ,b.name mail_state from mail a
left join dict_data b on a.mail_state=b.value
left join dict_data b on a.mail_state=b.value
left join mail_mark c on a.id=c.mail_id
left join mail_mark c on a.id=c.mail_id
/* where c.resolved ='1' or satisfied='1'*/
where 1=1
<if test= "id != null and id != ''" > and a.second_dept_id=#{id} </if>
/*c.resolved ='1' or satisfied='1'*/
order by a.create_time desc limit 20;
order by a.create_time desc limit 20;
</select>
</select>
@ -18,13 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY second_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
GROUP BY second_dept_name order by rateNumber desc limit 10
</select>
</select>
<select id= "getResolvedRate" resultType= "java.util.Map" >
<select id= "getResolvedRate" resultType= "java.util.Map" >
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
select b.second_dept_name name,
CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY second_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
GROUP BY second_dept_name order by rateNumber desc limit 10
</select>
</select>
<select id= "getSatisfiedRate" resultType= "java.util.Map" >
<select id= "getSatisfiedRate" resultType= "java.util.Map" >
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
@ -38,35 +44,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
</select>
<select id= "getStationResolvedRateByDept" resultType= "java.util.Map" parameterType= "String" >
<select id= "getStationResolvedRateByDept" resultType= "java.util.Map" parameterType= "String" >
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
</select>
<select id= "getStationSatisfiedRateByDept" resultType= "java.util.Map" parameterType= "String" >
<select id= "getStationSatisfiedRateByDept" resultType= "java.util.Map" parameterType= "String" >
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
</select>
<select id= "getTodayMailCount" resultType= "Integer" parameterType= "String" >
<select id= "getTodayMailCount" resultType= "Integer" parameterType= "String" >
select count(1) mailCount from mail where create_time>=CURRENT_DATE
select count(1) mailCount from mail where create_time>=CURRENT_DATE
<if test= "deptId != null and deptId != ''" > and second_dep_id=#{deptId} </if>
<if test= "deptId != null and deptId != ''" > and second_dept _id=#{deptId} </if>
</select>
</select>
<select id= "getAllMailCount" resultType= "Integer" >
<select id= "getAllMailCount" resultType= "Integer" >
select count(1) as countSum from mail_mark
select count(1) as countSum from mail_mark where 1=1 <if test= "deptId != null and deptId != ''" > and second_dept_id=#{deptId} </if>
</select>
</select>
<select id= "getResolvedRateByDeptId" resultType= "java.util.Map" >
<select id= "getResolvedRateByDeptId" resultType= "java.util.Map" >
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,SUM(COALESCE(b.resolved, 0)) resolved,
count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
<if test= "deptId != null and deptId != ''" > and b.second_dept_id=#{deptId} GROUP BY second_dept_name </if>
<if test= "deptId != null and deptId != ''" > and b.second_dept_id=#{deptId} GROUP BY second_dept_name </if>
@ -89,14 +96,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "deptId != null and deptId != ''" > and a.category='2' and b.second_dept_id=#{deptId} GROUP BY second_dept_name</if>
<if test= "deptId != null and deptId != ''" > and a.category='2' and b.second_dept_id=#{deptId} GROUP BY second_dept_name</if>
</select>
</select>
<select id= "mailTypeRank" resultType= "java.util.Map" >
<select id= "mailTypeRank" resultType= "java.util.Map" parameterType= "java.util.Map" >
select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber , mail_first_category category,count(1) sumCount ,CONCAT(ROUND(count(1)*100/(select count(1) from mail),0),'%') countRate
select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber ,
from mail group by mail_first_category limit 10
mail_first_category category,count(1) sumCount ,
CONCAT(ROUND(count(1)*100/(select count(1) from mail where 1=1
<if test= "id != null and id != ''" > and second_dept_id=#{id} </if>
),0),'%') countRate
FROM
mail
where 1=1
<if test= "id != null and id != ''" > and second_dept_id=#{id} </if>
GROUP BY
mail_first_category
order by sumCount desc
LIMIT 10
</select>
</select>
<select id= "getMailDayTrend" resultType= "java.util.Map" >
<select id= "getMailDayTrend" resultType= "java.util.Map" >
select TO_CHAR(create_time, 'YYYY/MM/DD') create_time,count(1) countsum from mail
select TO_CHAR(create_time, 'YYYY/MM/DD') create_time,count(1) countsum from mail
WHERE create_time between #{startDate} and #{endDate}
WHERE
1=1
<if test= "deptId != null and deptId != ''" >
and second_dept_id=#{deptId}
</if>
<if test= "startDate != null and startDate != ''" >
and create_time between #{startDate} and #{endDate}
</if>
group by TO_CHAR(create_time, 'YYYY/MM/DD') order by create_time
group by TO_CHAR(create_time, 'YYYY/MM/DD') order by create_time
</select>
</select>
@ -106,14 +132,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
EXTRACT(YEAR FROM create_time) AS year,
EXTRACT(YEAR FROM create_time) AS year,
EXTRACT(WEEK FROM create_time) AS week ,
EXTRACT(WEEK FROM create_time) AS week ,
count(1) countSum
count(1) countSum
FROM mail WHERE create_time between #{startDate} and #{endDate}
FROM mail WHERE 1=1
<if test= "deptId != null and deptId != ''" >
and second_dept_id=#{deptId}
</if>
<if test= "startDate != null and startDate != ''" >
and create_time between #{startDate} and #{endDate}
</if>
GROUP BY year,week order by year,week) a
GROUP BY year,week order by year,week) a
</select>
</select>
<select id= "getMailMonthTrend" resultType= "java.util.Map" >
<select id= "getMailMonthTrend" resultType= "java.util.Map" >
SELECT
SELECT
to_char(create_time::DATE, 'MM') AS month ,
to_char(create_time::DATE, 'MM') AS month ,
count(1) countSum
count(1) countSum
FROM mail where EXTRACT(YEAR FROM create_time)=#{year}
FROM mail where
1=1
<if test= "deptId != null and deptId != ''" >
and second_dept_id=#{deptId}
</if>
<if test= "year != null and year != ''" >
and EXTRACT(YEAR FROM create_time)=#{year}
</if>
GROUP BY month order by month
GROUP BY month order by month
</select>
</select>
<select id= "mapData" resultType= "java.util.Map" >
<select id= "mapData" resultType= "java.util.Map" >
@ -134,6 +173,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY d.name,a.id
GROUP BY d.name,a.id
</select>
</select>
<select id= "currentCountyMapJSON" resultType= "java.util.Map" parameterType= "java.lang.String" >
select geometry from county_street_dept where 1=1
<if test= "deptId != null and deptId != ''" > and dept_id=#{deptId}</if>
limit 1
</select>
<select id= "getToDayDuty" resultType= "com.biutag.entity.system.Duty" >
select a.* from duty a
inner join dept b on a.depart_id=b.id where
now() BETWEEN a.start_time and a.end_time
<if test= "depatType!=null and depatType!=''" >
and a.dept_type=#{depatType}
</if>
<if test= "deptId!=null and deptId!=''" >
and b.pid=#{deptId}
</if>
order by a.create_time desc
</select>
<select id= "mapCountyData" resultType= "java.util.Map" parameterType= "java.lang.String" >
select d.name, a.id,
(select count(1) mailCount from mail c where c.create_time>=CURRENT_DATE and c.three_dept_id=a.id) todaysum ,
CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') resolvedRate,
SUM(COALESCE(b.resolved, 0)) resolved,
ROUND(sum(COALESCE(b.completed, 0))*100/count(b.mail_id),0) value,
CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(b.mail_id),0),'%') completedRate,
SUM(COALESCE(b.completed, 0)) completed,
CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') satisfiedRate,
SUM(COALESCE(b.satisfied, 0)) satisfied,
count(1) allsum
from mail_mark b left join dept a on a.id=b.three_dept_id
inner join county_street_dept d on b.three_dept_id=d.dept_id
where 1=1
<if test= "deptId != null and deptId != ''" > and b.second_dept_id=#{deptId}</if>
GROUP BY d.name,a.id
</select>
</mapper>
</mapper>