he2802 há 2 anos atrás
pai
commit
defb23b972

+ 3 - 48
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml

@@ -126,7 +126,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         c.*
         FROM
         course_section c
-        LEFT JOIN course_section_business csb ON csb.section_id  = c.section_id
         WHERE
         1 = 1 AND c.status !=-1
         <if test="name != null and name != ''">
@@ -136,13 +135,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND c.publish_status = #{publishStatus}
         </if>
         <if test="educationTypeId != null and educationTypeId != ''">
-            AND csb.education_type_id = #{educationTypeId}
+            AND (select count(*) from course_section_business csb where csb.section_id = c.section_id and  education_type_id = #{educationTypeId})>0
         </if>
         <if test="subjectId != null and subjectId != ''">
-            AND csb.subject_id = #{subjectId}
+            AND (select count(*) from course_section_business csb where csb.section_id = c.section_id and subject_id = #{subjectId})>0
         </if>
         <if test="businessId != null and businessId != ''">
-            AND csb.business_id = #{businessId}
+            AND (select count(*) from course_section_business csb where csb.section_id = c.section_id and business_id = #{businessId})>0
         </if>
         <if test="sectionType != null and sectionType != ''">
             AND c.section_type = #{sectionType}
@@ -168,54 +167,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="importNo != null and importNo != ''">
             AND c.import_no = #{importNo}
         </if>
-        GROUP BY
-        c.section_id
         ORDER BY c.section_id DESC
     </select>
 
 
-    <select id="selectSectionList_COUNT" resultType="Long">
-        SELECT
-        count(distinct c.section_id )
-        FROM
-        course_section c
-        LEFT JOIN course_section_business csb ON c.section_id = csb.section_id
-        WHERE
-        1 = 1
-        <if test="name != null and name != ''">
-            AND c.name like concat('%', #{name}, '%')
-        </if>
-        <if test="publishStatus != null ">
-            AND c.publish_status = #{publishStatus}
-        </if>
-        <if test="educationTypeId != null and educationTypeId != ''">
-            AND csb.education_type_id = #{educationTypeId}
-        </if>
-        <if test="subjectId != null and subjectId != ''">
-            AND csb.subject_id = #{subjectId}
-        </if>
-        <if test="businessId != null and businessId != ''">
-            AND csb.business_id = #{businessId}
-        </if>
-        <if test="sectionType != null and sectionType != ''">
-            AND c.section_type = #{sectionType}
-        </if>
-        <if test="prefixName != null and prefixName != ''">
-            AND c.prefix_name like concat('%', #{prefixName}, '%')
-        </if>
-        <if test="key != null and key != ''">
-            AND (c.name like concat('%', #{key}, '%') or c.prefix_name like concat('%', #{key}, '%') or c.code = #{key})
-        </if>
-        <if test="status != null and status.size()!=0 ">
-            AND c.status in
-            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
-        </if>
-        <if test="importNo != null and importNo != ''">
-            AND c.import_no = #{importNo}
-        </if>
-    </select>
 
     <select id="overSectionList" parameterType="map" resultMap="CourseSectionResultVo">
         SELECT * from course_section cs where cs.section_type = 2 and cs.live_end_time >= #{startTime} and  #{endTime} >= cs.live_end_time