Browse Source

作者:张哲
时间:2023/03/27
类型:开发
描述:里程碑(3) 处理删除的一级分类也要统计的情况

zizg 1 year ago
parent
commit
6a1be2a9e0

+ 2 - 4
src/main/resources/mapper/knowledge/analysis/AnalysisAlbumMapper.xml

@@ -6,7 +6,6 @@
         select PK_ID
         FROM KM_ALBUM_CATEGORY
         where IS_DEL = 0
-          and PARENT = '0'
     </select>
 
     <select id="selectAlbumId" resultType="int">
@@ -14,10 +13,9 @@
         from KM_ALBUM_INFO
         WHERE CATEGORY_ID IN (SELECT c.PK_ID
         FROM KM_ALBUM_CATEGORY c
-        WHERE c.IS_DEL = 0
+        WHERE
         START WITH c.PK_ID = #{categoryId}
-        CONNECT BY PRIOR c.PK_ID = c.PARENT
-        and c.IS_DEL = 0)
+        CONNECT BY PRIOR c.PK_ID = c.PARENT)
         <if test="firstDay != null and lastDay != null">
             and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
             and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}

+ 2 - 2
src/main/resources/mapper/knowledge/analysis/AnalysisCommonMapper.xml

@@ -41,7 +41,7 @@
     <select id="level1Knowledge" resultType="string">
         select PK_ID
         from KM_KNOWLEDGE_CATEGORY
-        where PARENT = '0' and IS_DEL = 0
+        where PARENT = '0'
     </select>
 
     <select id="level1KnowledgeHistogram" resultType="int">
@@ -49,7 +49,7 @@
         from  KM_KNOWLEDGE
         <where>
             CATEGORY_ID IN (
-            SELECT c.PK_ID FROM KM_KNOWLEDGE_CATEGORY c WHERE c.IS_DEL = 0 START WITH c.PK_ID = #{categoryId} CONNECT BY PRIOR c.PK_ID = c.PARENT and c.IS_DEL = 0
+            SELECT c.PK_ID FROM KM_KNOWLEDGE_CATEGORY c WHERE START WITH c.PK_ID = #{categoryId} CONNECT BY PRIOR c.PK_ID = c.PARENT
             )
            <if test="firstDay != null and lastDay != null">
                and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}