guohongjin
2024-05-15 5b7639f0bd9e056738ec15100ed0532e965c6cd5
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
<?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="cn.stylefeng.guns.modular.business.mapper.MentalTestTopicMapper">
 
    <select id="topicPage" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestTopicPageDTO">
        SELECT * FROM t_mental_test_topic o
        <where>
            AND status_flag = 1
            AND is_delete = 0
            <if test="classIdList != null and classIdList.size != 0">
                AND
                <foreach collection="classIdList" item="item" index="index" open="(" separator=" OR " close=")">
                    FIND_IN_SET(#{item}, class_id) > 0
                </foreach>
            </if>
            <if test="title != null and title != ''">
                AND o.title LIKE CONCAT('%', #{title}, '%')
            </if>
            <if test="testType != null">
                AND o.test_type = #{testType}
            </if>
            <if test="testFlag != null">
                AND o.id <if test="testFlag == 0">NOT</if> IN (SELECT topic_id FROM t_mental_test_result WHERE user_id = #{userId})
            </if>
            <if test="statusFlag != null">
                AND o.status_flag = #{statusFlag}
            </if>
        </where>
    </select>
 
</mapper>