duhongyu %!s(int64=9) %!d(string=před) měsíci
rodič
revize
2d0e414d87

+ 9 - 0
hjzx-api/src/main/java/api/controller/report/DataAnalysisController.java

@@ -10,6 +10,7 @@ import api.util.enums.BusinessType;
10 10
 import io.swagger.annotations.Api;
11 11
 import io.swagger.annotations.ApiOperation;
12 12
 import lombok.var;
13
+import org.checkerframework.checker.units.qual.A;
13 14
 import org.springframework.beans.factory.annotation.Autowired;
14 15
 import org.springframework.web.bind.annotation.*;
15 16
 
@@ -113,6 +114,10 @@ public class DataAnalysisController extends BaseController {
113 114
     @Log(title = "区域业务类型",businessType = BusinessType.QUERY)
114 115
     @GetMapping("/selectBusinessType/{type}")
115 116
     public AjaxResult selectBusinessAreaType(@PathVariable long type, Long area  )  {
117
+        if (area==null)
118
+        {
119
+            area=1743L;
120
+        }
116 121
         var obj =DataAnalysisService.selectBusinessType(type,area);
117 122
         return Success("成功",obj);
118 123
     }
@@ -120,6 +125,10 @@ public class DataAnalysisController extends BaseController {
120 125
     @Log(title = "区域关键词数量",businessType = BusinessType.QUERY)
121 126
     @GetMapping("/selectAreaKeywordCount/{type}")
122 127
     public AjaxResult selectAreaKeywordCount(@PathVariable long type, Long area )  {
128
+        if (area==null)
129
+        {
130
+            area=1743L;
131
+        }
123 132
         var obj =DataAnalysisService.selectAreaKeywordCount(type,area);
124 133
         return Success("成功",obj);
125 134
     }

+ 20 - 10
hjzx-mapper/src/main/resources/mapper/report/ReportMapper.xml

@@ -253,20 +253,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
253 253
 	</select>
254 254
 
255 255
 	<select id="selectBusinessType"  parameterType="long" resultMap="CompleteView">
256
+		WITH RECURSIVE sub_areas AS (
256 257
 
258
+		SELECT id FROM sys_area WHERE id = #{area}
259
+		UNION ALL
260
+
261
+		SELECT a.id FROM sys_area a
262
+		INNER JOIN sub_areas sa ON a.parent_id = sa.id
263
+		)
257 264
 		select   Name , SUM(number) number  from
258 265
 		(select   CONCAT(ancestors, ',', id) ancestors,type_name Name  from  workorder_type where category=0 and parent_id=0 and is_delete=0) a
259
-		left join (select COUNT(1) number,  CONCAT((select ancestors from workorder_type where id=workordercate ),',',workordercate)  ancestors  from wo_workorderbase
260
-		where createtime >= CURDATE() - INTERVAL DAY(CURDATE()) - 1 DAY
261
-		AND createtime <![CDATA[<=]]> DATE_ADD(CURDATE() - DAY(CURDATE()) + 1, INTERVAL 1 MONTH)
262
-		and isdelete=0
266
+		left join (select COUNT(1) number,  CONCAT((select ancestors from workorder_type where id=workordercate ),',',workordercate)  ancestors  from
267
+		 wo_workorderbase  o JOIN sub_areas sa ON o.area = sa.id
268
+		where  isdelete=0
263 269
 		<if test="time != null and time !='' ">
264 270
 			and YEAR(createtime) = YEAR(CURRENT_DATE)
265 271
 			AND ${time}(createtime) = ${time}(CURRENT_DATE)
266 272
 		</if>
267
-		<if test="area >0  ">
268
-			AND `area`= #{area}
269
-		</if>
270 273
 		group by ancestors)  b on  CONCAT(b.ancestors,',')  LIKE CONCAT('%', a.ancestors,',' '%')
271 274
 		group by Name
272 275
 
@@ -474,6 +477,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
474 477
 		</if>
475 478
 	</select>
476 479
 	<select id="selectAreaKeywordCount"  parameterType="Long" resultMap="CompleteView">
480
+		WITH RECURSIVE sub_areas AS (
481
+
482
+		SELECT id FROM sys_area WHERE id =  #{area}
483
+		UNION ALL
484
+
485
+		SELECT a.id FROM sys_area a
486
+		INNER JOIN sub_areas sa ON a.parent_id = sa.id
487
+		)
477 488
 		SELECT
478 489
 		keyword_text AS `Name`,
479 490
 		SUM(keyword_count) AS `number`
@@ -489,10 +500,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
489 500
 		keyword_count INT PATH '$.count'
490 501
 		)
491 502
 		) AS jt
503
+		JOIN sub_areas sa ON o.area = sa.id
492 504
 		WHERE
493
-		<if test="area >0   ">
494
-			o.area = #{area}
495
-		</if>
505
+		1=1
496 506
 		<if test="time != null and time !='' ">
497 507
 			and YEAR(createtime) = YEAR(CURRENT_DATE)
498 508
 			AND ${time}(createtime) = ${time}(CURRENT_DATE)