linwe
2024-05-29 c10d6358b9f014375a13821465bc978d0c0da22e
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?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.subjectChoices.mapper.SubjectChoicesMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="subjectChoicesResultMap" type="org.springblade.modules.subjectChoices.vo.SubjectChoicesVO">
        <result property="id" column="id"/>
        <result property="parentId" column="parent_id"/>
        <result property="categoryName" column="category_name"/>
        <result property="subclassName" column="subclass_name"/>
        <result property="subjectName" column="subject_name"/>
        <result property="choicesType" column="choices_type"/>
        <result property="score" column="score"/>
        <result property="creator" column="creator"/>
        <result property="createDate" column="create_date"/>
        <result property="modifier" column="modifier"/>
        <result property="modifyDate" column="modify_date"/>
        <result property="delFlag" column="del_flag"/>
        <result property="level" column="level"/>
        <!--        <collection property="subjectOptionList" javaType="java.util.List"-->
        <!--                    ofType="org.springblade.modules.subjectOption.entity.SubjectOptionEntity" autoMapping="true">-->
        <!--            <id property="subjectChoicesId" column="id"/>-->
        <!--        </collection>-->
 
        <collection property="subjectOptionList" column="id" javaType="java.util.List"
                    ofType="org.springblade.modules.subjectOption.entity.SubjectOptionEntity"
                    autoMapping="true"
                    select="selectCircleCommentByParentId"></collection>
 
    </resultMap>
 
    <select id="selectCircleCommentByParentId" parameterType="long"
            resultType="org.springblade.modules.subjectOption.vo.SubjectOptionVO">
        SELECT
        jso.*
        FROM
        jczz_subject_option jso
        WHERE
        jso.subject_choices_id = #{id}
    </select>
 
 
    <select id="selectSubjectChoicesPage" resultMap="subjectChoicesResultMap">
        select
        id,
        parent_id,
        category_name,
        subclass_name,
        subject_name,
        choices_type,
        score,
        creator,
        create_date,
        modifier,
        modify_date,
        del_flag,
        level
        from
        jczz_subject_choices
        <where>
            <if test="subjectChoices.id != null ">and id = #{subjectChoices.id}</if>
            <if test="subjectChoices.parentId != null ">and parent_id = #{subjectChoices.parentId}</if>
            <if test="subjectChoices.categoryName != null  and subjectChoices.categoryName != ''">and category_name =
                #{subjectChoices.categoryName}
            </if>
            <if test="subjectChoices.subclassName != null  and subjectChoices.subclassName != ''">and subclass_name =
                #{subjectChoices.subclassName}
            </if>
            <if test="subjectChoices.subjectName != null  and subjectChoices.subjectName != ''">and subject_name =
                #{subjectChoices.subjectName}
            </if>
            <if test="subjectChoices.choicesType != null ">and choices_type = #{subjectChoices.choicesType}</if>
            <if test="subjectChoices.score != null ">and score = #{subjectChoices.score}</if>
            <if test="subjectChoices.creator != null  and subjectChoices.creator != ''">and creator =
                #{subjectChoices.creator}
            </if>
            <if test="subjectChoices.createDate != null ">and create_date = #{subjectChoices.createDate}</if>
            <if test="subjectChoices.modifier != null  and subjectChoices.modifier != ''">and modifier =
                #{subjectChoices.modifier}
            </if>
            <if test="subjectChoices.modifyDate != null ">and modify_date = #{subjectChoices.modifyDate}</if>
            <if test="subjectChoices.delFlag != null ">and del_flag = #{subjectChoices.delFlag}</if>
            <if test="subjectChoices.level != null ">and level = #{subjectChoices.level}</if>
 
        </where>
        order by level desc
 
    </select>
 
 
    <resultMap type="org.springblade.modules.subjectChoices.dto.SubjectChoicesDTO" id="SubjectChoicesDTOResult">
        <result property="id" column="id"/>
        <result property="parentId" column="parent_id"/>
        <result property="categoryName" column="category_name"/>
        <result property="subclassName" column="subclass_name"/>
        <result property="subjectName" column="subject_name"/>
        <result property="choicesType" column="choices_type"/>
        <result property="score" column="score"/>
        <result property="creator" column="creator"/>
        <result property="createDate" column="create_date"/>
        <result property="modifier" column="modifier"/>
        <result property="modifyDate" column="modify_date"/>
        <result property="delFlag" column="del_flag"/>
        <result property="level" column="level"/>
    </resultMap>
 
    <sql id="selectSubjectChoices">
        select
            id,
            parent_id,
            category_name,
            subclass_name,
            subject_name,
            choices_type,
            score,
            creator,
            create_date,
            modifier,
            modify_date,
            del_flag,
            level
        from
            jczz_subject_choices
    </sql>
 
    <select id="selectSubjectChoicesById" parameterType="long" resultMap="SubjectChoicesDTOResult">
        <include refid="selectSubjectChoices"/>
        where
        id = #{id}
    </select>
 
    <select id="selectSubjectChoicesList" parameterType="org.springblade.modules.subjectChoices.dto.SubjectChoicesDTO"
            resultMap="SubjectChoicesDTOResult">
        <include refid="selectSubjectChoices"/>
        <where>
            <if test="id != null ">and id = #{id}</if>
            <if test="parentId != null ">and parent_id = #{parentId}</if>
            <if test="categoryName != null  and categoryName != ''">and category_name = #{categoryName}</if>
            <if test="subclassName != null  and subclassName != ''">and subclass_name = #{subclassName}</if>
            <if test="subjectName != null  and subjectName != ''">and subject_name = #{subjectName}</if>
            <if test="choicesType != null ">and choices_type = #{choicesType}</if>
            <if test="score != null ">and score = #{score}</if>
            <if test="creator != null  and creator != ''">and creator = #{creator}</if>
            <if test="createDate != null ">and create_date = #{createDate}</if>
            <if test="modifier != null  and modifier != ''">and modifier = #{modifier}</if>
            <if test="modifyDate != null ">and modify_date = #{modifyDate}</if>
            <if test="delFlag != null ">and del_flag = #{delFlag}</if>
            <if test="level != null ">and level = #{level}</if>
        </where>
    </select>
 
 
</mapper>