Administrator 2 роки тому
батько
коміт
05dd447c52

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/IndexController.java

@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.info;
 
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.system.service.IIndexService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -37,4 +39,16 @@ public class IndexController extends BaseController {
     public AjaxResult jobStyle() {
         return indexService.getJobStyle();
     }
+
+    /**
+     * 列表页计算多少次核酸
+     * @return
+     */
+    @GetMapping("/heSuanCount")
+    public AjaxResult heSuanCount() {
+        LoginUser loginUser = getLoginUser();
+        SysUser sysUser = loginUser.getUser();
+        Long deptId = sysUser.getDeptId();
+        return indexService.getHeSuanCount(deptId);
+    }
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserNucleicTimeMapper.java

@@ -87,4 +87,6 @@ public interface UserNucleicTimeMapper
      * @return
      */
     public List<UserNucleicTime> getJobStyle(Date weekTime);
+
+    public int getHeSuanCount(Long deptId);
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IIndexService.java

@@ -20,4 +20,10 @@ public interface IIndexService {
      */
     public AjaxResult getJobStyle();
 
+    /**
+     * 列表页计算多少次核酸
+     * @return
+     */
+    public AjaxResult getHeSuanCount(Long deptId);
+
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IUserNucleicTimeService.java

@@ -70,4 +70,10 @@ public interface IUserNucleicTimeService
      * @return
      */
     public List<UserNucleicTime> getJobStyle();
+
+    /**
+     * 列表页计算多少次核酸
+     * @return
+     */
+    public int getHeSuanCount(Long deptId);
 }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/IndexServiceImpl.java

@@ -80,4 +80,14 @@ public class IndexServiceImpl implements IIndexService {
         map.put("y",yResult);
         return AjaxResult.success(map);
     }
+
+    /**
+     * 列表页计算多少次核酸
+     * @return
+     */
+    @Override
+    public AjaxResult getHeSuanCount(Long deptId) {
+        int heSuanCount = userNucleicTimeService.getHeSuanCount(deptId);
+        return AjaxResult.success(heSuanCount);
+    }
 }

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserNucleicTimeServiceImpl.java

@@ -147,4 +147,9 @@ public class UserNucleicTimeServiceImpl implements IUserNucleicTimeService
         List<UserNucleicTime> jobStyle = userNucleicTimeMapper.getJobStyle(nowDate);
         return jobStyle;
     }
+
+    @Override
+    public int getHeSuanCount(Long deptId) {
+        return userNucleicTimeMapper.getHeSuanCount(deptId);
+    }
 }

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/UserNucleicTimeMapper.xml

@@ -89,4 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectUserNucleicTimeVo"/>
         where DATE_FORMAT(nucleic_collect_time,'%x-%v') = DATE_FORMAT(now(),'%x-%v')
     </select>
+    <select id="getHeSuanCount" resultType="java.lang.Integer">
+        select ifnull(count(1),0) from `user_nucleic_time` where dept_id = #{deptId}
+    </select>
 </mapper>