From e5767d9f509ce698c3d88d7ee4bb4c4c5f1a67b7 Mon Sep 17 00:00:00 2001 From: c1769 <c@c.c> Date: Thu, 17 Aug 2023 16:55:54 +0800 Subject: [PATCH] =?UTF-8?q?group=20by=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/tz_financial.sql | 8 ++++---- web/src/main/resources/sql/jlw/userExaminations.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/tz_financial.sql b/sql/tz_financial.sql index 8c77b4e..0eee8d1 100644 --- a/sql/tz_financial.sql +++ b/sql/tz_financial.sql @@ -11,7 +11,7 @@ Target Server Version : 80025 (8.0.25) File Encoding : 65001 - Date: 16/08/2023 17:20:53 + Date: 17/08/2023 16:54:51 */ SET NAMES utf8mb4; @@ -1179,7 +1179,7 @@ CREATE TABLE `sys_log` ( PRIMARY KEY (`id`) USING BTREE, INDEX `token`(`token` ASC) USING BTREE, INDEX `create_time`(`create_time` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2824 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '行为日志' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '行为日志' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of sys_log @@ -1195,7 +1195,7 @@ CREATE TABLE `sys_log_text` ( `params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求参数', `result` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '结果', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of sys_log_text @@ -1483,6 +1483,6 @@ INSERT INTO `yszk_transfer` VALUES (1, '2023-08-13 12:20:27', '2023-08-13 12:20: -- View structure for user_integral -- ---------------------------- DROP VIEW IF EXISTS `user_integral`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `user_integral` AS select `t10`.`user_id` AS `user_id`,`t10`.`class_id` AS `class_id`,`t10`.`total_integral` AS `integral`,row_number() OVER (ORDER BY `t10`.`total_integral` desc ) AS `integral_order` from (select `t9`.`user_id` AS `user_id`,sum((`t9`.`integral` + `t9`.`ext_integral`)) AS `total_integral`,`t9`.`class_id` AS `class_id` from (select `t2`.`user_id` AS `user_id`,`t3`.`mode` AS `MODE`,`t2`.`class_id` AS `class_id`,sum((50 - (30 * (1 - `t3`.`mode`)))) AS `integral`,sum(distinct `t1`.`flow_id`) AS `flow_id_sum`,(case when (sum(distinct `t1`.`flow_id`) > 14) then (100 * (`t3`.`mode` + 1)) else 0 end) AS `ext_integral` from ((`financings` `t1` join `user_examinations` `t2` on((`t1`.`instance_id` = `t2`.`instance_id`))) join `examinations` `t3` on((`t2`.`examination_id` = `t3`.`id`))) where ((`t1`.`financing_status` = 9) and (`t3`.`mode` is not null) and (`t3`.`type` = 0)) group by `t2`.`user_id`,`t3`.`mode`) `t9` group by `t9`.`user_id`) `t10`; +CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `user_integral` AS select `t10`.`user_id` AS `user_id`,max(`t10`.`class_id`) AS `class_id`,max(`t10`.`total_integral`) AS `integral`,row_number() OVER (ORDER BY `t10`.`total_integral` desc ) AS `integral_order` from (select `t9`.`user_id` AS `user_id`,sum((`t9`.`integral` + `t9`.`ext_integral`)) AS `total_integral`,max(`t9`.`class_id`) AS `class_id` from (select `t2`.`user_id` AS `user_id`,`t3`.`mode` AS `MODE`,`t2`.`class_id` AS `class_id`,sum((50 - (30 * (1 - `t3`.`mode`)))) AS `integral`,sum(distinct `t1`.`flow_id`) AS `flow_id_sum`,(case when (sum(distinct `t1`.`flow_id`) > 14) then (100 * (`t3`.`mode` + 1)) else 0 end) AS `ext_integral` from ((`financings` `t1` join `user_examinations` `t2` on((`t1`.`instance_id` = `t2`.`instance_id`))) join `examinations` `t3` on((`t2`.`examination_id` = `t3`.`id`))) where ((`t1`.`financing_status` = 9) and (`t3`.`mode` is not null) and (`t3`.`type` = 0)) group by `t2`.`user_id`,`t3`.`mode`) `t9` group by `t9`.`user_id`) `t10`; SET FOREIGN_KEY_CHECKS = 1; diff --git a/web/src/main/resources/sql/jlw/userExaminations.md b/web/src/main/resources/sql/jlw/userExaminations.md index 50ae1ad..aeb4ab8 100644 --- a/web/src/main/resources/sql/jlw/userExaminations.md +++ b/web/src/main/resources/sql/jlw/userExaminations.md @@ -429,9 +429,9 @@ getTeacherClassExaminationScoreChart ```` select t2.id examination_id, - t2.name examination_name, + max(t2.name) examination_name, t3.class_id, - t4.name class_name, + max(t4.name) class_name, avg(t1.total_scores) total_scores from user_examinations t1 join examinations t2 on t1.examination_id = t2.id