Pārlūkot izejas kodu

作者:张哲
时间:2023/08/21
类型:开发
描述:当前登陆人上传的知识数量和专辑的点评数量

zizg 1 gadu atpakaļ
vecāks
revīzija
89e91fff2b

+ 8 - 0
src/main/java/com/redxun/knowledge/analysis/controller/AnalysisCommonController.java

@@ -336,4 +336,12 @@ public class AnalysisCommonController {
         analysisDownloadService.download(downloadDto,httpServletResponse);
 
     }
+
+    @ApiOperation("展示当前登陆员工的知识上传数和专辑评论数")
+    @GetMapping("knowledgeSumAndYelpSumByLogin")
+    public JsonResult knowledgeSumAndYelpSumByLogin(){
+        JsonResult jsonResult = JsonResult.getSuccessResult("");
+        Map<String,Object> result = analysisCommonService.knowledgeSumAndYelpSumByLogin();
+        return jsonResult.setData(result);
+    }
 }

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

@@ -109,4 +109,18 @@ public interface AnalysisCommonMapper {
 
     List<Integer> personKnowledgeValue(@Param("id") String id, @Param("firstDay") String createTime,
                                        @Param("lastDay")String endTime,@Param("round") Integer round);
+
+    /**
+     * 当前用户知识上传量
+     * @param userId
+     * @return
+     */
+    Integer knowledgeSum(@Param("userId") String userId);
+
+    /**
+     * 当前用户专辑评论量
+     * @param userId
+     * @return
+     */
+    Integer yelpSum(@Param("userId") String userId);
 }

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

@@ -421,4 +421,20 @@ public class AnalysisCommonServiceImpl {
         return result;
 
     }
+
+    /**
+     * 员工的知识上传数和专辑评论数
+     * @return
+     */
+    public Map<String, Object> knowledgeSumAndYelpSumByLogin() {
+        Map<String, Object> map = new HashMap<>();
+        String userId = userService.queryLoginUser();
+        //知识上传量
+        Integer knowledgeSum = analysisCommonMapper.knowledgeSum(userId);
+        //专辑点评量
+        Integer yelpSum = analysisCommonMapper.yelpSum(userId);
+        map.put("knowledgeSum",knowledgeSum);
+        map.put("yelpSum",yelpSum);
+        return map;
+    }
 }

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

@@ -130,6 +130,28 @@
         </where>
     </select>
 
+    <select id="knowledgeSum" resultType="int">
+        select count(*)
+        from KM_KNOWLEDGE
+        <where>
+            APPROVAL_STATUS = 5
+            <if test="userId != null">
+                and CREATE_BY_ = #{userId}
+            </if>
+        </where>
+    </select>
+
+    <select id="yelpSum" resultType="int">
+        select count(*)
+        from KM_ALBUM_YELP
+        <where>
+            APPROVAL_STATE = 5
+            <if test="userId != null">
+                and CREATE_BY_ = #{userId}
+            </if>
+        </where>
+    </select>
+
 
 </mapper>