linwe
2024-08-09 8b7258c9427882bb1798f1502eaa35184c6e374e
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
<?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="org.springblade.modules.answerRecord.mapper.AnswerRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="answerRecordResultMap" type="org.springblade.modules.answerRecord.entity.AnswerRecordEntity">
    </resultMap>
 
 
    <select id="selectAnswerRecordPage" resultMap="answerRecordResultMap">
        select * from jczz_answer_record where is_deleted = 0
    </select>
 
    <resultMap type="org.springblade.modules.answerRecord.dto.AnswerRecordDTO" id="AnswerRecordDTOResult">
        <result property="id" column="id"/>
        <result property="subjectChoicesId" column="subject_choices_id"/>
        <result property="subjectChoicesType" column="subject_choices_type"/>
        <result property="subjectOptionId" column="subject_option_id"/>
        <result property="answerOption" column="answer_option"/>
        <result property="answerScore" column="answer_score"/>
        <result property="propertyId" column="property_id"/>
        <result property="scoreId" column="score_id"/>
        <result property="answer" column="answer"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
 
    <sql id="selectAnswerRecord">
        select
            id,
            subject_choices_id,
            subject_choices_type,
            subject_option_id,
            answer_option,
            answer_score,
            property_id,
            score_id,
            answer,
            create_time
        from
            jczz_answer_record
    </sql>
 
    <select id="selectAnswerRecordById" parameterType="long" resultMap="AnswerRecordDTOResult">
        <include refid="selectAnswerRecord"/>
        where
        id = #{id}
    </select>
 
    <select id="selectAnswerRecordList" parameterType="org.springblade.modules.answerRecord.dto.AnswerRecordDTO"
            resultMap="AnswerRecordDTOResult">
        <include refid="selectAnswerRecord"/>
        <where>
            <if test="id != null ">and id = #{id}</if>
            <if test="subjectChoicesId != null ">and subject_choices_id = #{subjectChoicesId}</if>
            <if test="subjectChoicesType != null ">and subject_choices_type = #{subjectChoicesType}</if>
            <if test="subjectOptionId != null ">and subject_option_id = #{subjectOptionId}</if>
            <if test="answerOption != null  and answerOption != ''">and answer_option = #{answerOption}</if>
            <if test="answerScore != null ">and answer_score = #{answerScore}</if>
            <if test="propertyId != null ">and property_id = #{propertyId}</if>
            <if test="scoreId != null ">and score_id = #{scoreId}</if>
            <if test="answer != null ">and answer = #{answer}</if>
            <if test="createTime != null ">and create_time = #{createTime}</if>
        </where>
    </select>
 
</mapper>