sql修复

beetlsql3-dev
Mlxa0324 2 years ago
parent 1097a4a88f
commit fdf30dd650

@ -417,7 +417,7 @@
Common.awaitTime(1200, function () {
//window.location.href = ret.data;
// window.location.href = "http://116.205.131.177:8080/Login";
window.location.href = Common.ctxPath;
window.location.href = Common.ctxPath.replace(/\/server\/?/, '');
});
}
});

@ -24,7 +24,7 @@ spring.datasource.dynamic.hikari.connection-test-query=SELECT 1
spring.datasource.dynamic.datasource.master.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/tianze-pro?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
spring.datasource.dynamic.datasource.master.username=tianze-pro
spring.datasource.dynamic.datasource.master.password=xYR3A4EXCWxkHmNX
spring.datasource.dynamic.datasource.master.password=xYR3A4EXCWxkHmNX
spring.datasource.dynamic.datasource.master.hikari.max-lifetime=60000
# ds2

@ -803,6 +803,21 @@ getQuestionTestSimpleInfo
* 学生端- 题目的简单信息(包含学生得分)
SELECT
@pageTag(){
z.general_question_setting_id,
z.general_question_setting_name,
z.general_question_setting_type,
z.general_question_start_time,
z.general_question_end_time,
z.question_total_count,
z.is_finished,
z.finish_time,
z.finish_second_time,
z.my_success_count,
round(z.my_success_count / z.question_total_count * 100, 2) as correct_rate
@}
FROM
(
SELECT
t.general_question_setting_id,
t.general_question_setting_name,
t.general_question_setting_type,
@ -810,28 +825,19 @@ getQuestionTestSimpleInfo
t.general_question_end_time,
(
SELECT
sum(
@ // 已经交卷的状态才算分
CASE WHEN ta.question_log_add_type = #questionLogAddType# THEN IFNULL( ta.student_score, 0 ) ELSE 0 END
)
@// 我的分数
sum( ta.student_score )
FROM
general_question_log ta
WHERE
ta.general_question_setting_id = t.general_question_setting_id
and ta.general_question_log_status = 1
AND t.general_question_setting_status = 1
AND t.general_question_setting_push_status = 1
AND ta.general_question_log_status = 1
AND ta.question_log_add_type = #questionLogAddType#
AND ta.student_id = #studentId#
) AS my_score,
(
SELECT
count( 1 )
FROM
general_resources_question_snapshot tb
WHERE
tb.general_question_setting_id = t.general_question_setting_id
AND tb.question_status = 1
) AS question_total_count,
@// 题目总数
( SELECT count( 1 ) FROM general_resources_question_snapshot tb WHERE tb.general_question_setting_id = t.general_question_setting_id AND tb.question_status = 1 ) AS question_total_count,
@// 是否交卷
(
SELECT
count( 1 ) > 0
@ -840,55 +846,59 @@ getQuestionTestSimpleInfo
WHERE
tc.general_question_setting_id = t.general_question_setting_id
AND tc.general_question_log_status = 1
@ // 是否已交卷
AND tc.question_log_add_type = #questionLogAddType#
LIMIT 1
) AS is_finished,
@// 完成时间 00:00:00
(
SELECT max(TIMEDIFF( td.general_question_log_update_time , td.general_question_log_add_time )) as finish_time
FROM general_question_log td
WHERE td.general_question_log_status = 1
@if(!isEmpty(studentId)) {
and td.student_id = #studentId#
@}
and td.question_log_add_type = #questionLogAddType#
and td.general_question_setting_id = t.general_question_setting_id
AND td.general_question_log_update_time IS NOT NULL
) as finish_time,
SELECT
max(
TIMEDIFF( td.general_question_log_update_time, td.general_question_log_add_time )) AS finish_time
FROM
general_question_log td
WHERE
td.general_question_log_status = 1
AND td.student_id = #studentId#
AND td.question_log_add_type = #questionLogAddType#
AND td.general_question_setting_id = t.general_question_setting_id
) AS finish_time,
@// 完成时间(秒)
(
SELECT abs(max(TIMESTAMPDIFF(SECOND, te.general_question_log_update_time , te.general_question_log_add_time ))) as finish_second_time
FROM general_question_log te
WHERE te.general_question_log_status = 1
@if(!isEmpty(studentId)) {
and te.student_id = #studentId#
@}
and te.question_log_add_type = #questionLogAddType#
and te.general_question_setting_id = t.general_question_setting_id
AND te.general_question_log_update_time IS NOT NULL
) as finish_second_time,
SELECT
abs(
max(
TIMESTAMPDIFF( SECOND, te.general_question_log_update_time, te.general_question_log_add_time )))
FROM
general_question_log te
WHERE
te.general_question_log_status = 1
AND te.student_id = #studentId#
AND te.question_log_add_type = #questionLogAddType#
AND te.general_question_setting_id = t.general_question_setting_id
) AS finish_second_time,
@// 题目正确数大于0就算对的
(
SELECT round(sum(case when tf.question_score = tf.student_score then 1 else 0 end)
/ ifnull(count(distinct(tf.general_resources_question_snapshot_id)), 0) * 100, 2) as finish_second_time
FROM general_question_log tf
WHERE tf.general_question_log_status = 1
@if(!isEmpty(studentId)) {
and tf.student_id = #studentId#
@}
and tf.question_log_add_type = #questionLogAddType#
and tf.general_question_setting_id = t.general_question_setting_id
AND tf.general_question_log_update_time IS NOT NULL
) as correct_rate
@}
SELECT
sum( tf.student_score > 0 )
FROM
general_question_log tf
WHERE
tf.general_question_log_status = 1
AND tf.student_id = #studentId#
AND tf.question_log_add_type = #questionLogAddType#
AND tf.general_question_setting_id = t.general_question_setting_id
) AS my_success_count
FROM
general_question_setting t
left join course_info za on za.course_info_id = t.business_id and t.business_type = 'FROM_SYSTEM'
WHERE
1 = 1
AND t.general_question_setting_type = #generalQuestionSettingType#
AND t.general_question_setting_type = #teacherOpenCourseQuestionSettingType#
AND t.general_question_setting_push_status = 1
AND t.general_question_setting_status = 1
AND za.course_info_parent_id = #courseInfoParentId#
order by t.general_question_setting_name asc
AND t.general_id = #teacherOpenCourseId#
ORDER BY
t.general_question_setting_name ASC
) z
questionTestResults

@ -589,36 +589,44 @@ getValuesByQueryNotWithPermission
getQuestionTestSimpleInfo
===
* 学生端- 题目的简单信息(包含学生得分)
SELECT
@pageTag(){
z.teacher_open_course_question_setting_id,
z.teacher_open_course_question_setting_name,
z.teacher_open_course_question_setting_type,
z.teacher_open_course_question_start_time,
z.teacher_open_course_question_end_time,
z.question_total_count,
z.is_finished,
z.finish_time,
z.finish_second_time,
z.my_success_count,
round(z.my_success_count / z.question_total_count * 100, 2) as correct_rate
@}
FROM
(
SELECT
t.teacher_open_course_question_setting_id,
t.teacher_open_course_question_setting_name,
t.teacher_open_course_question_setting_type,
t.teacher_open_course_question_start_time,
t.teacher_open_course_question_end_time,
(
SELECT
sum(ta.student_score)
FROM
teacher_open_course_question_log ta
WHERE
ta.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and ta.teacher_open_course_question_log_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_push_status = 1
@ // 是否已交卷
AND ta.question_log_add_type = #questionLogAddType#
AND ta.student_id = #studentId#
) AS my_score,
(
SELECT
count( 1 )
FROM
resources_question_snapshot tb
WHERE
tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tb.question_status = 1
) AS question_total_count,
SELECT
@// 我的分数
sum( ta.student_score )
FROM
teacher_open_course_question_log ta
WHERE
ta.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND ta.teacher_open_course_question_log_status = 1
AND ta.question_log_add_type = #questionLogAddType#
AND ta.student_id = #studentId#
) AS my_score,
@// 题目总数
( SELECT count( 1 ) FROM resources_question_snapshot tb WHERE tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND tb.question_status = 1 ) AS question_total_count,
@// 是否交卷
(
SELECT
count( 1 ) > 0
@ -627,51 +635,48 @@ getQuestionTestSimpleInfo
WHERE
tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tc.teacher_open_course_question_log_status = 1
@ // 是否已交卷
AND tc.question_log_add_type = #questionLogAddType#
LIMIT 1
) AS is_finished,
@// 完成时间 00:00:00
(
SELECT max(TIMEDIFF( td.teacher_open_course_question_log_update_time , td.teacher_open_course_question_log_add_time )) as finish_time
FROM teacher_open_course_question_log td
WHERE td.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and td.student_id = #studentId#
@}
and td.question_log_add_type = #questionLogAddType#
and td.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) as finish_time,
SELECT
max(
TIMEDIFF( td.teacher_open_course_question_log_update_time, td.teacher_open_course_question_log_add_time )) AS finish_time
FROM
teacher_open_course_question_log td
WHERE
td.teacher_open_course_question_log_status = 1
AND td.student_id = #studentId#
AND td.question_log_add_type = #questionLogAddType#
AND td.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS finish_time,
@// 完成时间(秒)
(
SELECT abs(max(TIMESTAMPDIFF(SECOND, te.teacher_open_course_question_log_update_time , te.teacher_open_course_question_log_add_time )))
FROM teacher_open_course_question_log te
WHERE te.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and te.student_id = #studentId#
@}
and te.question_log_add_type = #questionLogAddType#
and te.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) as finish_second_time,
round(
SELECT
abs(
max(
TIMESTAMPDIFF( SECOND, te.teacher_open_course_question_log_update_time, te.teacher_open_course_question_log_add_time )))
FROM
teacher_open_course_question_log te
WHERE
te.teacher_open_course_question_log_status = 1
AND te.student_id = #studentId#
AND te.question_log_add_type = #questionLogAddType#
AND te.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS finish_second_time,
@// 题目正确数大于0就算对的
(
SELECT sum(tf.student_score <> 1 )
FROM teacher_open_course_question_log tf
WHERE tf.teacher_open_course_question_log_status = 1
@if(!isEmpty(studentId)) {
and tf.student_id = #studentId#
@}
and tf.question_log_add_type = #questionLogAddType#
and tf.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) / (
SELECT
count(DISTINCT ( t.resources_question_snapshot_id ))
FROM
resources_question_snapshot t
WHERE
1 = 1
AND t.question_status = 1
AND t.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) ,2) * 100 as correct_rate
@}
sum( tf.student_score > 0 )
FROM
teacher_open_course_question_log tf
WHERE
tf.teacher_open_course_question_log_status = 1
AND tf.student_id = #studentId#
AND tf.question_log_add_type = #questionLogAddType#
AND tf.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS my_success_count
FROM
teacher_open_course_question_setting t
WHERE
@ -680,8 +685,9 @@ getQuestionTestSimpleInfo
AND t.teacher_open_course_question_setting_push_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
order by t.teacher_open_course_question_setting_name asc
ORDER BY
t.teacher_open_course_question_setting_name ASC
) z
questionTestResults
===

Loading…
Cancel
Save