fuliqi
2024-06-19 d0ba0324430a0010ecf47e5cc0e4df609d586cfd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?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.ycl.jxkg.mapper.ExamPaperQuestionCustomerAnswerMapper">
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.ExamPaperQuestionCustomerAnswer">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="question_id" jdbcType="INTEGER" property="questionId"/>
        <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId"/>
        <result column="exam_paper_answer_id" jdbcType="INTEGER" property="examPaperAnswerId"/>
        <result column="question_type" jdbcType="INTEGER" property="questionType"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
        <result column="customer_score" jdbcType="INTEGER" property="customerScore"/>
        <result column="question_score" jdbcType="INTEGER" property="questionScore"/>
        <result column="question_content" jdbcType="VARCHAR" property="questionContent"/>
        <result column="answer" jdbcType="VARCHAR" property="answer"/>
        <result column="text_content_id" jdbcType="INTEGER" property="textContentId"/>
        <result column="do_right" jdbcType="BIT" property="doRight"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="item_order" jdbcType="INTEGER" property="itemOrder"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , question_id, exam_paper_id, exam_paper_answer_id, question_type, subject_id,
    customer_score, question_score, question_content, answer, text_content_id,
    do_right, create_user, create_time, item_order
    </sql>
 
 
    <select id="selectListByPaperAnswerId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_exam_paper_question_customer_answer
        where exam_paper_answer_id = #{id,jdbcType=INTEGER}
        order by item_order
    </select>
 
 
    <select id="studentPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.domain.vo.student.question.answer.QuestionPageStudentRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper_question_customer_answer
        <where>
            and do_right=FALSE
            and create_user=#{createUser}
        </where>
    </select>
 
    <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into t_exam_paper_question_customer_answer ( question_id, question_score,
        subject_id, create_time, create_user,
        text_content_id, exam_paper_id, question_type,
        answer, customer_score, exam_paper_answer_id ,
        do_right,question_content,item_order)
        values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            ( #{item.questionId,jdbcType=INTEGER}, #{item.questionScore,jdbcType=INTEGER},
            #{item.subjectId,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
            #{item.createUser,jdbcType=INTEGER},
            #{item.textContentId,jdbcType=INTEGER}, #{item.examPaperId,jdbcType=INTEGER},
            #{item.questionType,jdbcType=INTEGER},
            #{item.answer,jdbcType=VARCHAR}, #{item.customerScore,jdbcType=INTEGER},
            #{item.examPaperAnswerId,jdbcType=INTEGER},
            #{item.doRight,jdbcType=BIT},#{item.questionTextContentId,jdbcType=INTEGER},#{item.itemOrder,jdbcType=INTEGER})
        </foreach>
    </insert>
 
 
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_exam_paper_question_customer_answer
    </select>
 
 
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper_question_customer_answer
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
 
    <update id="updateScore" parameterType="java.util.List">
        <foreach collection="list" item="item">
            update t_exam_paper_question_customer_answer
            set customer_score=#{item.customerScore} , do_right=#{item.doRight}
            where id=#{item.id} ;
        </foreach>
    </update>
 
</mapper>