Переглянути джерело

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

zizg 1 рік тому
батько
коміт
ea90fb1f3e

+ 3 - 0
src/main/java/com/redxun/knowledge/analysis/mapper/AnalysisAlbumMapper.java

@@ -59,4 +59,7 @@ public interface AnalysisAlbumMapper {
      * @return
      */
     List<CreateCountLabel> albumAmount(@Param("firstDay") String firstDay,@Param("lastDay") String lastDay);
+
+    String selectCategoryName(String categoryId);
+
 }

+ 2 - 0
src/main/java/com/redxun/knowledge/analysis/mapper/AnalysisCommonMapper.java

@@ -89,4 +89,6 @@ public interface AnalysisCommonMapper {
      * @return
      */
     List<Integer> organizationKnowledges(@Param("companyId") String companyId,@Param("firstDay") String firstDay,@Param("lastDay") String lastDay);
+
+    String selectCategoryName(String categoryId);
 }

+ 1 - 1
src/main/java/com/redxun/knowledge/analysis/service/AnalysisAlbumServiceImpl.java

@@ -138,7 +138,7 @@ public class AnalysisAlbumServiceImpl {
                 albumIdList = analysisAlbumMapper.selectAlbumId(categoryId, firstOfMonth, lastOfMonth);
                 knowledgeList = analysisAlbumMapper.selectKnowledge(categoryId, firstOfMonth, lastOfMonth);
             }
-            albumCategoryVo.setLabel(albumCategoryMapper.selectById(categoryId).getName());
+            albumCategoryVo.setLabel(analysisAlbumMapper.selectCategoryName(categoryId));
             albumCategoryVo.setAlbum(albumIdList);
             albumCategoryVo.setKnowledge(knowledgeList);
             return albumCategoryVo;

+ 1 - 1
src/main/java/com/redxun/knowledge/analysis/service/AnalysisCommonServiceImpl.java

@@ -204,7 +204,7 @@ public class AnalysisCommonServiceImpl {
             Calendar calendar = Calendar.getInstance();
             int year = calendar.get(Calendar.YEAR);
             KnowledgeCategoryVo knowledgeCategoryVo = new KnowledgeCategoryVo();
-            knowledgeCategoryVo.setLabel(knowledgeCategoryMapper.selectById(e).getName());
+            knowledgeCategoryVo.setLabel(analysisCommonMapper.selectCategoryName(e));
             //查询知识分类下创建的知识数量(纬度:年 最近1个月 全部)
             if (type.equals("total")) {
                 count = analysisCommonMapper.level1KnowledgeHistogram(e, null, null);

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

@@ -5,7 +5,7 @@
     <select id="selectCategory" resultType="string">
         select PK_ID
         FROM KM_ALBUM_CATEGORY
-        where IS_DEL = 0
+        where PARENT = '0'
     </select>
 
     <select id="selectAlbumId" resultType="int">
@@ -13,7 +13,6 @@
         from KM_ALBUM_INFO
         WHERE CATEGORY_ID IN (SELECT c.PK_ID
         FROM KM_ALBUM_CATEGORY c
-        WHERE
         START WITH c.PK_ID = #{categoryId}
         CONNECT BY PRIOR c.PK_ID = c.PARENT)
         <if test="firstDay != null and lastDay != null">
@@ -100,5 +99,9 @@
 
     </select>
 
+    <select id="selectCategoryName" resultType="string">
+        select NAME from KM_ALBUM_CATEGORY where PK_ID = #{categoryId}
+    </select>
+
 
 </mapper>

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

@@ -49,7 +49,7 @@
         from  KM_KNOWLEDGE
         <where>
             CATEGORY_ID IN (
-            SELECT c.PK_ID FROM KM_KNOWLEDGE_CATEGORY c WHERE START WITH c.PK_ID = #{categoryId} CONNECT BY PRIOR c.PK_ID = c.PARENT
+            SELECT c.PK_ID FROM KM_KNOWLEDGE_CATEGORY c 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}
@@ -73,6 +73,10 @@
         </where>
     </select>
 
+    <select id="selectCategoryName" resultType="string">
+        select NAME from KM_KNOWLEDGE_CATEGORY where PK_ID = #{pkId}
+    </select>
+
 
 </mapper>