Browse Source

2024/11/28 现场督察完成1.1 (修改问题趋势的sql语句)

main
parent
commit
de8815791a
  1. 20
      src/main/resources/mapper/NegativeMapper.xml

20
src/main/resources/mapper/NegativeMapper.xml

@ -4,7 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.NegativeMapper">
<select id="getSupervisionTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo">
WITH months AS (
SELECT m.monthName AS `name`, IFNULL(COUNT(ng.discoveryTime), 0) AS `value`
FROM (
SELECT '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
@ -16,9 +18,7 @@
SELECT '09', '9月' UNION ALL
SELECT '10', '10月' UNION ALL
SELECT '11', '11月' UNION ALL
SELECT '12', '12月' )
SELECT m.monthName AS `name`, IFNULL(COUNT(ng.discoveryTime), 0) AS `value`
FROM months m LEFT JOIN negative ng
SELECT '12', '12月' ) m LEFT JOIN negative ng
ON DATE_FORMAT(ng.discoveryTime, '%m') = m.month
AND YEAR(ng.discoveryTime) = #{time}
AND ng.checkStatus != 3
@ -28,7 +28,11 @@
</select>
<select id="getGobalRecentlyTrendByMonth" resultType="com.biutag.supervision.pojo.vo.EchartsVo">
WITH months AS (
SELECT
m.monthName AS `name`,
IFNULL(COUNT(ng.discoveryTime), 0) AS `value`
FROM (
SELECT '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
@ -41,11 +45,7 @@
SELECT '10', '10月' UNION ALL
SELECT '11', '11月' UNION ALL
SELECT '12', '12月'
)
SELECT
m.monthName AS `name`,
IFNULL(COUNT(ng.discoveryTime), 0) AS `value`
FROM months m
) m
LEFT JOIN
negative ng on DATE_FORMAT(ng.discoveryTime, '%m')=m.month
AND YEAR(ng.discoveryTime)=#{year}

Loading…
Cancel
Save