fix (farm): 大屏,微信端
- 大屏模拟数据维护 - 微信端切换租户
This commit is contained in:
@@ -68,4 +68,43 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getScreenDisasterDataStatisticsInfo"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.managementcenter.largescreen.screendisasterdata.vo.DisasterDataStatisticsInfoRespVO">
|
||||
SELECT
|
||||
CASE ct.category_type
|
||||
WHEN '0' THEN '气象'
|
||||
WHEN '1' THEN '虫害'
|
||||
WHEN '2' THEN '病害'
|
||||
WHEN '3' THEN '草害'
|
||||
END as category,
|
||||
ms.month_str as disasterTime,
|
||||
YEAR(STR_TO_DATE(CONCAT(ms.month_str, '-01'), '%Y-%m-%d')) as year,
|
||||
COALESCE(SUM(fsdd.disaster_count), 0) as totalCount
|
||||
FROM (
|
||||
SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL n MONTH), '%Y-%m') as month_str
|
||||
FROM (
|
||||
SELECT 0 as n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5
|
||||
UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10 UNION SELECT 11
|
||||
UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 UNION SELECT 15 UNION SELECT 16 UNION SELECT 17
|
||||
UNION SELECT 18 UNION SELECT 19 UNION SELECT 20 UNION SELECT 21 UNION SELECT 22 UNION SELECT 23
|
||||
) months
|
||||
) ms
|
||||
CROSS JOIN (
|
||||
SELECT '0' as category_type
|
||||
UNION ALL
|
||||
SELECT '1' as category_type
|
||||
UNION ALL
|
||||
SELECT '2' as category_type
|
||||
UNION ALL
|
||||
SELECT '3' as category_type
|
||||
) ct
|
||||
LEFT JOIN farm_screen_disaster_data fsdd ON
|
||||
ct.category_type = fsdd.category
|
||||
AND ms.month_str = fsdd.disaster_time
|
||||
AND fsdd.deleted = 0
|
||||
AND fsdd.use_status = 1
|
||||
GROUP BY ct.category_type, ms.month_str
|
||||
ORDER BY ms.month_str, ct.category_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user