|
@@ -359,4 +359,146 @@
|
359
|
359
|
GROUP BY problem_attribute
|
360
|
360
|
ORDER BY t1.problem_attribute
|
361
|
361
|
</select>
|
|
362
|
+
|
|
363
|
+ <select id="getQuarterStatistics" resultType="java.util.Map">
|
|
364
|
+ SELECT "QUARTER",IFNULL(sum(num), '0') "num"
|
|
365
|
+ FROM (SELECT t."QUARTER", (t."sum" - t."two" - t."one") / "total" AS "num"
|
|
366
|
+ FROM (SELECT EXTRACT(
|
|
367
|
+ QUARTER
|
|
368
|
+ FROM
|
|
369
|
+ pp."create_time"
|
|
370
|
+ ) "QUARTER",
|
|
371
|
+ sum(pr."full_score"),
|
|
372
|
+ COUNT(0) total,
|
|
373
|
+ SUM(CASE
|
|
374
|
+ pp."problem_level"
|
|
375
|
+ WHEN 2 THEN pr."problem_level_two"
|
|
376
|
+ ELSE '0'
|
|
377
|
+ END) AS "two",
|
|
378
|
+ sum(CASE
|
|
379
|
+ pp."problem_level"
|
|
380
|
+ WHEN 1 THEN pr."problem_level_one"
|
|
381
|
+ ELSE '0'
|
|
382
|
+ END) AS "one"
|
|
383
|
+ FROM "public"."post_checked_problem" pp
|
|
384
|
+ INNER JOIN "public"."post_assessment_rules" pr ON
|
|
385
|
+ pp."duty_type" = pr."duty_type"
|
|
386
|
+ AND pr."type" = 1
|
|
387
|
+ WHERE to_date(pp."create_time", 'YYYY') = to_date(#{year}, 'YYYY')
|
|
388
|
+ GROUP BY EXTRACT(
|
|
389
|
+ QUARTER
|
|
390
|
+ FROM
|
|
391
|
+ pp."create_time"
|
|
392
|
+ )) t
|
|
393
|
+ union all
|
|
394
|
+ SELECT EXTRACT(
|
|
395
|
+ QUARTER
|
|
396
|
+ FROM
|
|
397
|
+ "create_time"
|
|
398
|
+ ) AS "QUARTER",
|
|
399
|
+ sum("by_dept_score") / count(0) "num"
|
|
400
|
+
|
|
401
|
+ FROM "public"."post_assessment_rating_other_info"
|
|
402
|
+ WHERE to_date("create_time", 'YYYY') = to_date(#{year}, 'YYYY')
|
|
403
|
+ GROUP BY EXTRACT(
|
|
404
|
+ QUARTER
|
|
405
|
+ FROM
|
|
406
|
+ "create_time"
|
|
407
|
+ )) a
|
|
408
|
+ GROUP BY a."QUARTER"
|
|
409
|
+ </select>
|
|
410
|
+
|
|
411
|
+ <select id="getYearStatistics" resultType="java.util.Map">
|
|
412
|
+ SELECT "YEAR",IFNULL(sum(num), '0') "num"
|
|
413
|
+ FROM (SELECT t."YEAR", (t."sum" - t."two" - t."one") / "total" AS "num"
|
|
414
|
+ FROM (SELECT EXTRACT(
|
|
415
|
+ YEAR
|
|
416
|
+ FROM
|
|
417
|
+ pp."create_time"
|
|
418
|
+ ) "YEAR",
|
|
419
|
+ sum(pr."full_score"),
|
|
420
|
+ COUNT(0) total,
|
|
421
|
+ SUM(CASE
|
|
422
|
+ pp."problem_level"
|
|
423
|
+ WHEN 2 THEN pr."problem_level_two"
|
|
424
|
+ ELSE '0'
|
|
425
|
+ END) AS "two",
|
|
426
|
+ sum(CASE
|
|
427
|
+ pp."problem_level"
|
|
428
|
+ WHEN 1 THEN pr."problem_level_one"
|
|
429
|
+ ELSE '0'
|
|
430
|
+ END) AS "one"
|
|
431
|
+ FROM "public"."post_checked_problem" pp
|
|
432
|
+ INNER JOIN "public"."post_assessment_rules" pr ON
|
|
433
|
+ pp."duty_type" = pr."duty_type"
|
|
434
|
+ AND pr."type" = 1
|
|
435
|
+ GROUP BY EXTRACT(
|
|
436
|
+ YEAR
|
|
437
|
+ FROM
|
|
438
|
+ pp."create_time"
|
|
439
|
+ )) t
|
|
440
|
+ union all
|
|
441
|
+ SELECT EXTRACT(
|
|
442
|
+ YEAR
|
|
443
|
+ FROM
|
|
444
|
+ "create_time"
|
|
445
|
+ ) AS "YEAR",
|
|
446
|
+ sum("by_dept_score") / count(0) "num"
|
|
447
|
+
|
|
448
|
+ FROM "public"."post_assessment_rating_other_info"
|
|
449
|
+ GROUP BY EXTRACT(
|
|
450
|
+ YEAR
|
|
451
|
+ FROM
|
|
452
|
+ "create_time"
|
|
453
|
+ )) a
|
|
454
|
+ GROUP BY a."YEAR"
|
|
455
|
+ </select>
|
|
456
|
+
|
|
457
|
+ <select id="getMonthStatistics" resultType="java.util.Map">
|
|
458
|
+ SELECT "MONTH", IFNULL(sum(num), '0') "num"
|
|
459
|
+ FROM (SELECT t."MONTH", (t."sum" - t."two" - t."one") / "total" AS "num"
|
|
460
|
+ FROM (SELECT EXTRACT(
|
|
461
|
+ MONTH
|
|
462
|
+ FROM
|
|
463
|
+ pp."create_time"
|
|
464
|
+ ) "MONTH",
|
|
465
|
+ sum(pr."full_score"),
|
|
466
|
+ COUNT(0) total,
|
|
467
|
+ SUM(CASE
|
|
468
|
+ pp."problem_level"
|
|
469
|
+ WHEN 2 THEN pr."problem_level_two"
|
|
470
|
+ ELSE '0'
|
|
471
|
+ END) AS "two",
|
|
472
|
+ sum(CASE
|
|
473
|
+ pp."problem_level"
|
|
474
|
+ WHEN 1 THEN pr."problem_level_one"
|
|
475
|
+ ELSE '0'
|
|
476
|
+ END) AS "one"
|
|
477
|
+ FROM "public"."post_checked_problem" pp
|
|
478
|
+ INNER JOIN "public"."post_assessment_rules" pr ON
|
|
479
|
+ pp."duty_type" = pr."duty_type"
|
|
480
|
+ AND pr."type" = 1
|
|
481
|
+ WHERE to_date(pp."create_time", 'YYYY') = to_date(#{year}, 'YYYY')
|
|
482
|
+ GROUP BY EXTRACT(
|
|
483
|
+ MONTH
|
|
484
|
+ FROM
|
|
485
|
+ pp."create_time"
|
|
486
|
+ )) t
|
|
487
|
+ union all
|
|
488
|
+ SELECT EXTRACT(
|
|
489
|
+ MONTH
|
|
490
|
+ FROM
|
|
491
|
+ "create_time"
|
|
492
|
+ ) AS "MONTH",
|
|
493
|
+ sum("by_dept_score") / count(0) "num"
|
|
494
|
+
|
|
495
|
+ FROM "public"."post_assessment_rating_other_info"
|
|
496
|
+ WHERE to_date("create_time", 'YYYY') = to_date(#{year}, 'YYYY')
|
|
497
|
+ GROUP BY EXTRACT(
|
|
498
|
+ MONTH
|
|
499
|
+ FROM
|
|
500
|
+ "create_time"
|
|
501
|
+ )) a
|
|
502
|
+ GROUP BY a."MONTH"
|
|
503
|
+ </select>
|
362
|
504
|
</mapper>
|