You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-houduan/src/main/resources/mappers/AiTrainingEvaluationMapper.xml

118 lines
6.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sztzjy.linkCommerce.mapper.AiTrainingEvaluationMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.linkCommerce.entity.AiTrainingEvaluation">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="student_user_id" jdbcType="VARCHAR" property="studentUserId"/>
<result column="teaching_class_id" jdbcType="VARCHAR" property="teachingClassId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="task_key" jdbcType="VARCHAR" property="taskKey"/>
<result column="help_status" jdbcType="VARCHAR" property="helpStatus"/>
<result column="help_task_snapshot" jdbcType="LONGVARCHAR" property="helpTaskSnapshot"/>
<result column="help_answer_snapshot" jdbcType="LONGVARCHAR" property="helpAnswerSnapshot"/>
<result column="help_report_json" jdbcType="LONGVARCHAR" property="helpReportJson"/>
<result column="help_raw_response" jdbcType="LONGVARCHAR" property="helpRawResponse"/>
<result column="help_model" jdbcType="VARCHAR" property="helpModel"/>
<result column="help_completed_at" jdbcType="TIMESTAMP" property="helpCompletedAt"/>
<result column="help_error_message" jdbcType="VARCHAR" property="helpErrorMessage"/>
<result column="assessment_status" jdbcType="VARCHAR" property="assessmentStatus"/>
<result column="assessment_task_snapshot" jdbcType="LONGVARCHAR" property="assessmentTaskSnapshot"/>
<result column="assessment_answer_snapshot" jdbcType="LONGVARCHAR" property="assessmentAnswerSnapshot"/>
<result column="assessment_score" jdbcType="INTEGER" property="assessmentScore"/>
<result column="assessment_report_json" jdbcType="LONGVARCHAR" property="assessmentReportJson"/>
<result column="assessment_raw_response" jdbcType="LONGVARCHAR" property="assessmentRawResponse"/>
<result column="assessment_model" jdbcType="VARCHAR" property="assessmentModel"/>
<result column="assessment_completed_at" jdbcType="TIMESTAMP" property="assessmentCompletedAt"/>
<result column="assessment_error_message" jdbcType="VARCHAR" property="assessmentErrorMessage"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, student_user_id, teaching_class_id, task_id, task_key,
help_status, help_task_snapshot, help_answer_snapshot, help_report_json, help_raw_response,
help_model, help_completed_at, help_error_message,
assessment_status, assessment_task_snapshot, assessment_answer_snapshot, assessment_score,
assessment_report_json, assessment_raw_response, assessment_model, assessment_completed_at,
assessment_error_message, create_time, update_time
</sql>
<select id="findByStudentClassAndTask" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM ai_training_evaluation
WHERE student_user_id = #{studentUserId,jdbcType=VARCHAR}
AND teaching_class_id = #{teachingClassId,jdbcType=VARCHAR}
AND task_id = #{taskId,jdbcType=VARCHAR}
</select>
<insert id="insertIgnore" parameterType="com.sztzjy.linkCommerce.entity.AiTrainingEvaluation">
INSERT IGNORE INTO ai_training_evaluation (
id, student_user_id, teaching_class_id, task_id, task_key,
help_status, assessment_status, create_time, update_time
) VALUES (
#{id,jdbcType=VARCHAR}, #{studentUserId,jdbcType=VARCHAR}, #{teachingClassId,jdbcType=VARCHAR},
#{taskId,jdbcType=VARCHAR}, #{taskKey,jdbcType=VARCHAR},
#{helpStatus,jdbcType=VARCHAR}, #{assessmentStatus,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<update id="claimHelp">
UPDATE ai_training_evaluation
SET help_status = 'PROCESSING', help_error_message = NULL, update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR}
AND help_status IN ('NOT_STARTED', 'FAILED', 'SUCCEEDED')
</update>
<update id="claimAssessment">
UPDATE ai_training_evaluation
SET assessment_status = 'PROCESSING', assessment_error_message = NULL, update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR}
AND assessment_status IN ('NOT_STARTED', 'FAILED')
</update>
<update id="completeHelp" parameterType="com.sztzjy.linkCommerce.entity.AiTrainingEvaluation">
UPDATE ai_training_evaluation
SET help_status = 'SUCCEEDED',
help_task_snapshot = #{helpTaskSnapshot},
help_answer_snapshot = #{helpAnswerSnapshot},
help_report_json = #{helpReportJson},
help_raw_response = #{helpRawResponse},
help_model = #{helpModel,jdbcType=VARCHAR},
help_completed_at = #{helpCompletedAt,jdbcType=TIMESTAMP},
help_error_message = NULL,
update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR} AND help_status = 'PROCESSING'
</update>
<update id="completeAssessment" parameterType="com.sztzjy.linkCommerce.entity.AiTrainingEvaluation">
UPDATE ai_training_evaluation
SET assessment_status = 'SUCCEEDED',
assessment_task_snapshot = #{assessmentTaskSnapshot},
assessment_answer_snapshot = #{assessmentAnswerSnapshot},
assessment_score = #{assessmentScore,jdbcType=INTEGER},
assessment_report_json = #{assessmentReportJson},
assessment_raw_response = #{assessmentRawResponse},
assessment_model = #{assessmentModel,jdbcType=VARCHAR},
assessment_completed_at = #{assessmentCompletedAt,jdbcType=TIMESTAMP},
assessment_error_message = NULL,
update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR} AND assessment_status = 'PROCESSING'
</update>
<update id="failHelp">
UPDATE ai_training_evaluation
SET help_status = 'FAILED', help_error_message = #{errorMessage,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR} AND help_status = 'PROCESSING'
</update>
<update id="failAssessment">
UPDATE ai_training_evaluation
SET assessment_status = 'FAILED', assessment_error_message = #{errorMessage,jdbcType=VARCHAR},
assessment_raw_response = #{rawResponse,jdbcType=LONGVARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
WHERE id = #{id,jdbcType=VARCHAR} AND assessment_status = 'PROCESSING'
</update>
</mapper>