You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
169 lines
6.9 KiB
169 lines
6.9 KiB
<?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.biutag.supervision.mapper.NegativeMapper"> |
|
<!-- 趋势公用(视频、现场、案件) --> |
|
<select id="getTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT |
|
m.month_name AS `name`, |
|
COUNT( ng.id ) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime,'%m') = m.`month` |
|
AND YEAR(ng.crtTime) = #{year} |
|
AND ng.problemSourcesCode IN |
|
<foreach item="item" index="index" collection="args" open="(" separator="," close=")">#{item}</foreach> |
|
GROUP BY m.month_name |
|
ORDER BY m.`month` ASC; |
|
</select> |
|
<!-- 首页大屏问题趋势 --> |
|
<select id="getGlobalRecentlyTrendByMonth" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT m.month_name AS name, COUNT(DISTINCT ng.id) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime, '%m') = m.`month` |
|
AND YEAR(ng.crtTime) = #{year} |
|
-- AND ng.problemSourcesCode IN (2, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30) |
|
GROUP BY m.month_name |
|
ORDER BY m.`month` ASC |
|
</select> |
|
<!-- 信访投诉大屏问题趋势 --> |
|
<select id="getMailTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT m.month_name AS `name`, |
|
IFNULL(COUNT(dpc.create_time), 0) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN |
|
data_petition_complaint dpc on DATE_FORMAT(dpc.create_time, '%m') = m.month |
|
AND YEAR(dpc.create_time) = #{year} |
|
AND dpc.problem_sources_code = #{type} |
|
GROUP BY m.month_name |
|
ORDER BY m.month ASC; |
|
</select> |
|
<!-- 二级大屏的问题趋势(首页、现场、案件) --> |
|
<select id="getSubOneTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT |
|
m.month_name AS `name`, |
|
COUNT( ng.id ) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime,'%m') = m.`month` |
|
AND YEAR(ng.crtTime) = #{year} |
|
AND ng.problemSourcesCode IN |
|
<foreach item="item" index="index" collection="args" open="(" separator="," close=")">#{item}</foreach> |
|
AND ng.handle_second_depart_id=#{departId} |
|
GROUP BY m.month_name |
|
ORDER BY m.`month` ASC; |
|
</select> |
|
<!-- 视频督察二级大屏的问题趋势(查实)--> |
|
<select id="getSubOneVideoSuperviseTrend" |
|
resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT |
|
m.month_name AS `name`, |
|
IFNULL(COUNT(temp.id), 0) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN ( |
|
SELECT ng.id, ng.crtTime |
|
FROM negative ng |
|
WHERE ng.problemSourcesCode = #{problemCode} |
|
AND YEAR(ng.crtTime) = #{year} |
|
AND ng.involveDepartId IN |
|
<foreach collection="departIds" |
|
item="did" |
|
open="(" |
|
close=")" |
|
separator=","> |
|
#{did} |
|
</foreach> |
|
) temp |
|
ON DATE_FORMAT(temp.crtTime, '%m') = m.month |
|
GROUP BY m.month_name, m.month |
|
ORDER BY m.month ASC |
|
</select> |
|
|
|
<!-- 案件核查二级大屏的问题趋势--> |
|
<select id="getSubOneCaseVerificationTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT m.month_name AS `name`, |
|
COUNT(ng.id) AS `value` |
|
FROM sup_month_monthname m |
|
LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime, '%m') = m.`month` |
|
AND YEAR(ng.crtTime) = #{year} |
|
AND ng.problemSourcesCode IN (17, 18, 19, 20) |
|
AND ng.handle_second_depart_id = #{departId} |
|
GROUP BY m.month_name |
|
ORDER BY m.`month` ASC; |
|
</select> |
|
|
|
<select id="selectListBySampleId" resultType="com.biutag.supervision.pojo.entity.Negative"> |
|
SELECT id, checkStatusName, isRectifyName, sample_id FROM negative WHERE sample_id IN |
|
<foreach item="item" index="index" collection="args" open="(" separator="," close=")">#{item}</foreach> |
|
</select> |
|
|
|
|
|
|
|
<select id="getOrganizationRank" resultType="com.biutag.supervision.pojo.vo.OrganizeProblemRankVo"> |
|
select |
|
sd.short_name as label, |
|
count(1) as `value` |
|
FROM negative ng |
|
JOIN sup_depart sd ON sd.id = ng.involveDepartId |
|
<where> |
|
<if test="crtTime != null"> |
|
AND ng.crtTime BETWEEN #{crtTime[0]} AND #{crtTime[1]} |
|
</if> |
|
|
|
<!-- 部门集合 --> |
|
<if test="involveDepartIds != null"> |
|
AND ng.involveDepartId IN |
|
<foreach collection="involveDepartIds" item="involveDepartId" open="(" separator="," close=")"> |
|
#{involveDepartId} |
|
</foreach> |
|
</if> |
|
</where> |
|
GROUP BY sd.id, sd.short_name |
|
ORDER BY `value` DESC |
|
</select> |
|
|
|
|
|
<!-- 根据部门ID、时间范围和问题来源编码查询问题列表 --> |
|
<select id="getNegativeListData" resultType="com.biutag.supervision.pojo.entity.Negative"> |
|
select ng.* |
|
from negative ng |
|
LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id |
|
LEFT JOIN sup_depart sdd on sd.pid = sdd.id |
|
LEFT JOIN sup_depart sddd on sdd.pid = sddd.id |
|
where ng.problemSourcesCode in |
|
<foreach collection='codes' item='code' open='(' separator=',' close=')'> |
|
#{code} |
|
</foreach> |
|
and ng.crtTime >= #{beginTime} |
|
and ng.crtTime <= #{endTime} |
|
AND (sd.id = #{id} OR sdd.id = #{id} OR sddd.id = #{id}) |
|
</select> |
|
|
|
|
|
|
|
<select id="selectMonthStatByYear" resultType="com.biutag.supervision.pojo.vo.EchartsVo"> |
|
SELECT |
|
m.month_name AS name, |
|
COUNT(t.id) AS value |
|
FROM sup_month_monthname m |
|
LEFT JOIN ( |
|
SELECT |
|
ng.id, |
|
ng.crtTime |
|
FROM negative ng |
|
LEFT JOIN sup_depart sd ON ng.involveDepartId = sd.id |
|
LEFT JOIN sup_depart sdd ON sd.pid = sdd.id |
|
LEFT JOIN sup_depart sddd ON sdd.pid = sddd.id |
|
WHERE YEAR(ng.crtTime) = #{year} |
|
<if test="problemSourcesCodeList != null and problemSourcesCodeList.size() > 0"> |
|
AND ng.problemSourcesCode IN |
|
<foreach collection="problemSourcesCodeList" item="item" open="(" separator="," close=")"> |
|
#{item} |
|
</foreach> |
|
</if> |
|
AND ( sd.id = #{departId} OR sdd.id = #{departId} OR sddd.id = #{departId} ) ) t |
|
ON MONTH(t.crtTime) = CAST(m.month AS UNSIGNED) |
|
GROUP BY m.month, m.month_name |
|
ORDER BY CAST(m.month AS UNSIGNED) ASC |
|
</select> |
|
|
|
</mapper>
|
|
|