|
|
@ -1,10 +1,10 @@
|
|
|
|
package com.ibeetl.jlw.entity;
|
|
|
|
package com.ibeetl.jlw.entity;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
|
|
import com.ibeetl.admin.core.entity.BaseEntity;
|
|
|
|
import com.ibeetl.admin.core.entity.BaseEntity;
|
|
|
|
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
|
|
|
|
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
|
|
|
|
import lombok.Data;
|
|
|
|
import lombok.Data;
|
|
|
|
|
|
|
|
import org.beetl.sql.annotation.entity.Auto;
|
|
|
|
import org.beetl.sql.annotation.entity.Table;
|
|
|
|
import org.beetl.sql.annotation.entity.Table;
|
|
|
|
import org.beetl.sql.fetch.annotation.Fetch;
|
|
|
|
import org.beetl.sql.fetch.annotation.Fetch;
|
|
|
|
import org.beetl.sql.fetch.annotation.FetchSql;
|
|
|
|
import org.beetl.sql.fetch.annotation.FetchSql;
|
|
|
@ -21,6 +21,10 @@ import java.util.List;
|
|
|
|
@Table(name = "teacher_open_course_question_log")
|
|
|
|
@Table(name = "teacher_open_course_question_log")
|
|
|
|
public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Auto
|
|
|
|
|
|
|
|
private Long teacherOpenCourseQuestionLogId ;
|
|
|
|
|
|
|
|
|
|
|
|
/** ========================================================================= */
|
|
|
|
/** ========================================================================= */
|
|
|
|
/** ========== 这部分数据需要通过BeetlSQL来查询,才能自动触发FetchSql 注解 ========== */
|
|
|
|
/** ========== 这部分数据需要通过BeetlSQL来查询,才能自动触发FetchSql 注解 ========== */
|
|
|
|
//来源类型(枚举)
|
|
|
|
//来源类型(枚举)
|
|
|
@ -41,7 +45,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #teacherOpenCourseQuestionLogFromType# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #resourcesQuestionSnapshotFromType# " +
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') = ta.question_answer"
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') = ta.question_answer"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
private int correctCount;
|
|
|
|
private int correctCount;
|
|
|
@ -51,7 +55,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #teacherOpenCourseQuestionLogFromType# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #resourcesQuestionSnapshotFromType# " +
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer"
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
private int wrongCount;
|
|
|
|
private int wrongCount;
|
|
|
@ -62,7 +66,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"where t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #teacherOpenCourseQuestionLogFromType# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #resourcesQuestionSnapshotFromType# " +
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer"
|
|
|
|
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
private float totalScore;
|
|
|
|
private float totalScore;
|
|
|
@ -81,8 +85,8 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
"LEFT JOIN resources_question_snapshot ta ON ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"LEFT JOIN resources_question_snapshot ta ON ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
|
|
|
|
"WHERE t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"WHERE t.teacher_open_course_question_log_status = 1 " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.student_id = #studentId# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #teacherOpenCourseQuestionLogFromType# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_type = #resourcesQuestionSnapshotFromType# " +
|
|
|
|
"and t.teacher_open_course_question_log_from_id = #teacherOpenCourseQuestionLogFromId# "
|
|
|
|
"and t.teacher_open_course_question_log_from_id = #resourcesQuestionSnapshotFromId# "
|
|
|
|
)
|
|
|
|
)
|
|
|
|
private List<TeacherOpenCourseQuestionLog> questionLogList;
|
|
|
|
private List<TeacherOpenCourseQuestionLog> questionLogList;
|
|
|
|
|
|
|
|
|
|
|
@ -100,11 +104,12 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
* 尝试计算正确率
|
|
|
|
* 尝试计算正确率
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void tryCalcCorrectRate() {
|
|
|
|
private void tryCalcCorrectRate() {
|
|
|
|
if (ObjectUtil.isAllNotEmpty(this.getCorrectCount(), this.getWrongCount())) {
|
|
|
|
int temp = this.getCorrectCount() + this.getWrongCount();
|
|
|
|
|
|
|
|
if (this.getCorrectCount() > 0 && this.getWrongCount() > 0) {
|
|
|
|
// 计算正确率, 取小数点后2位数
|
|
|
|
// 计算正确率, 取小数点后2位数
|
|
|
|
// 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100
|
|
|
|
// 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100
|
|
|
|
this.setCorrectRate(NumberUtil
|
|
|
|
this.setCorrectRate(NumberUtil
|
|
|
|
.round(this.getCorrectCount() / (this.getCorrectCount() + this.getWrongCount()) * 100, 0)
|
|
|
|
.round(NumberUtil.div(this.getCorrectCount(), temp) * 100, 0)
|
|
|
|
.intValue());
|
|
|
|
.intValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|