Browse Source

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

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

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

@ -4,21 +4,21 @@
"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 '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
SELECT '04', '4月' UNION ALL
SELECT '05', '5月' UNION ALL
SELECT '06', '6月' UNION ALL
SELECT '07', '7月' UNION ALL
SELECT '08', '8月' UNION ALL
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
FROM (
SELECT '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
SELECT '04', '4月' UNION ALL
SELECT '05', '5月' UNION ALL
SELECT '06', '6月' UNION ALL
SELECT '07', '7月' UNION ALL
SELECT '08', '8月' UNION ALL
SELECT '09', '9月' UNION ALL
SELECT '10', '10月' UNION ALL
SELECT '11', '11月' UNION ALL
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,24 +28,24 @@
</select>
<select id="getGobalRecentlyTrendByMonth" resultType="com.biutag.supervision.pojo.vo.EchartsVo">
WITH months AS (
SELECT '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
SELECT '04', '4月' UNION ALL
SELECT '05', '5月' UNION ALL
SELECT '06', '6月' UNION ALL
SELECT '07', '7月' UNION ALL
SELECT '08', '8月' UNION ALL
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
FROM (
SELECT '01' AS month, '1月' AS monthName UNION ALL
SELECT '02', '2月' UNION ALL
SELECT '03', '3月' UNION ALL
SELECT '04', '4月' UNION ALL
SELECT '05', '5月' UNION ALL
SELECT '06', '6月' UNION ALL
SELECT '07', '7月' UNION ALL
SELECT '08', '8月' UNION ALL
SELECT '09', '9月' UNION ALL
SELECT '10', '10月' UNION ALL
SELECT '11', '11月' UNION ALL
SELECT '12', '12月'
) m
LEFT JOIN
negative ng on DATE_FORMAT(ng.discoveryTime, '%m')=m.month
AND YEAR(ng.discoveryTime)=#{year}

Loading…
Cancel
Save