|
|
@@ -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)
|