<?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.iocoder.byzs.module.bjdx.dal.mysql.courseconfig.CourseConfigMapper">


    <select id="selectCourseConfigPage" parameterType="cn.iocoder.byzs.module.bjdx.controller.admin.courseconfig.vo.CourseConfigPageReqVO" resultType="cn.iocoder.byzs.module.bjdx.controller.admin.courseconfig.vo.CourseConfigPageReqVO">
        SELECT cc.id, cc.cc_course_id as ccCourseId,
                cc_quest_source as ccQuestSource,
                cc_quest_content as ccQuestContent,
                cc_quest_option as ccQuestOption,
                cc_ai_answer as ccAiAnswer,
                cc_answer as ccAnswer, cc.cc_quest_id as ccQuestId, cc.cc_time as ccTime, cc.cc_answer_judge as ccAnswerJudge,
               c.course_name as courseName,
               cc_ai_quest_tip as ccAiQuestTip
        FROM bjdx_course_config cc
        LEFT JOIN bjdx_course c ON cc.cc_course_id = c.id
        <where>
                c.deleted = 0 and cc.deleted = 0
            <if test="ccCourseId != null and ccCourseId != ''">
                AND cc.cc_course_id  = #{ccCourseId}
            </if>
            <if test="ccQuestContent != null and ccQuestContent != ''">
                AND cc.cc_quest_content LIKE CONCAT('%', #{ccQuestContent}, '%')
            </if>
            <if test="ccTime != null and ccTime != ''">
                AND cc.cc_time LIKE CONCAT('%', #{ccTime}, '%')
            </if>
            <if test="ccAnswerJudge != null and ccAnswerJudge != ''">
                AND cc.cc_answer_judge = #{ccAnswerJudge}
            </if>
        </where>
    </select>
</mapper>