瀏覽代碼

自定义sql补充查询条件不查已删除数据

liyanbo 4 月之前
父節點
當前提交
6bdf1c4dfb

+ 1 - 1
byzs-course/src/main/resources/mapper/course/CourseMapper.xml

@@ -6,7 +6,7 @@
         FROM bjdx_course c
         LEFT JOIN bjdx_course_type ct ON c.course_type = ct.id
         <where>
-            c.deleted = 0
+            c.deleted = 0 AND ct.deleted = 0
             <if test="courseName != null and courseName != ''">
                 AND c.course_name LIKE CONCAT('%', #{courseName}, '%')
             </if>

+ 1 - 1
byzs-course/src/main/resources/mapper/coursequestoption/CourseQuestOptionMapper.xml

@@ -8,7 +8,7 @@
             resultType="cn.iocoder.byzs.module.bjdx.dal.dataobject.coursequestoption.CourseQuestOptionDO">
         select id,cqo_quest_id cqoQuestId, cqo_value cqoValue, cqo_option cqoOption, cqo_socre cqoSocre, cqo_is_answer cqoIsAnswer
                 from bjdx_course_quest_option
-        where cqo_quest_id in
+        where deleted = 0 AND cqo_quest_id in
         <foreach item="questId" collection="questIdSet"
                  open="(" separator="," close=")">
             #{questId}

+ 1 - 0
byzs-course/src/main/resources/mapper/questionnaire/QuestionnaireMapper.xml

@@ -18,6 +18,7 @@
         LEFT JOIN bjdx_questionnaire q ON q.id = qc.bqc_questionnaire_id
         LEFT JOIN bjdx_course_question cq ON qc.bqc_question_id = cq.id
         WHERE
+            qc.deleted = 0 AND q.deleted = 0 AND cq.deleted = 0
             <if test="questionnaireId != null">
                 q.id = #{questionnaireId}
             </if>

+ 1 - 0
byzs-web/src/main/resources/mapper/blockly/WebBlocklyMapper.xml

@@ -16,6 +16,7 @@
             blockly_course_type bct
                 LEFT JOIN blockly_course bc ON bct.id = bc.bc_type
         WHERE
+            bct.deleted = 0 AND bc.deleted = 0 AND bc.status = 0 AND
             bct.ct_parent_id = #{ctParentId}
         GROUP BY
             id, ctType, ctParentId, ctTypeImage, ctTypeSort;