Parcourir la source

下载工时占比表,个人可以下载自己的

seyason il y a 8 mois
Parent
commit
8ae0deb9e8

+ 5 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java

@@ -447,13 +447,16 @@ public class UserCorpwxTimeController {
         List<LocalDate> workDateList = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, 0);
         if (functionList.size() > 0) {
             //查看全部人员的
-            list = userCorpwxTimeMapper.getUserDataRatioList(user.getCompanyId(), workDateList, ymonth, null);
+            list = userCorpwxTimeMapper.getUserDataRatioList(user.getCompanyId(), workDateList, ymonth, null, null);
         } else {
             if (manageDeptId != null && manageDeptId != 0) {
                 //一个人可能担任多个部门负责人
                 List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
                 List<Integer> allManagedDeptIdList = departmentService.getAllManagedDeptIdList(user, allDeptList);
-                list = userCorpwxTimeMapper.getUserDataRatioList(user.getCompanyId(), workDateList, ymonth, allManagedDeptIdList);
+                list = userCorpwxTimeMapper.getUserDataRatioList(user.getCompanyId(), workDateList, ymonth, allManagedDeptIdList, null);
+            } else {
+                //个人的,可以看自己的
+                list = userCorpwxTimeMapper.getUserDataRatioList(user.getCompanyId(), workDateList, ymonth, null, user.getId());
             }
         }
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/UserCorpwxTimeMapper.java

@@ -19,7 +19,7 @@ public interface UserCorpwxTimeMapper extends BaseMapper<UserCorpwxTime> {
 
     public List<Map> getUserDataList(Integer companyId, String startDate, String endDate, Integer deptId, String userId);
 
-    public List<Map> getUserDataRatioList(Integer companyId, List<LocalDate> dateList, String ymonth, List<Integer> deptIds);
+    public List<Map> getUserDataRatioList(Integer companyId, List<LocalDate> dateList, String ymonth, List<Integer> deptIds, String userId);
 
     List<Map> selectByAsk(Integer companyId,String startDate,String endDate);
 }

+ 13 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserCorpwxTimeMapper.xml

@@ -61,15 +61,20 @@
                 #{date}
             </foreach> GROUP BY r.`creator_id` ) report_time
         ON report_time.creator_id = user.id
-        WHERE user.company_id=#{companyId}
-        and  ((user.`is_active` = 1 AND (user.`induction_date` IS NULL OR DATE_FORMAT(user.`induction_date`, '%Y%m') &lt;= #{ymonth} )) OR (user.`is_active` = 0 AND DATE_FORMAT(user.`inactive_date`, '%Y%m%d') &gt; CONCAT(#{ymonth}, '01')))
-        <if test="deptIds != null">
-            AND user.`department_id` in
-            <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
-                #{deptId}
-            </foreach>
+        WHERE user.company_id = #{companyId}
+        <if test="userId != null">
+            AND user.`id` = #{userId}
+        </if>
+        <if test="userId == null">
+            and  ((user.`is_active` = 1 AND (user.`induction_date` IS NULL OR DATE_FORMAT(user.`induction_date`, '%Y%m') &lt;= #{ymonth} )) OR (user.`is_active` = 0 AND DATE_FORMAT(user.`inactive_date`, '%Y%m%d') &gt; CONCAT(#{ymonth}, '01')))
+            <if test="deptIds != null">
+                AND user.`department_id` in
+                <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
+                    #{deptId}
+                </foreach>
+            </if>
+            ORDER BY user.id ASC
         </if>
-        ORDER BY user.id ASC
     </select>
 
     <select id="selectByAsk" resultType="java.util.Map">