ソースを参照

请假统计调整

dzx 10 ヶ月 前
コミット
efbb93f115

+ 5 - 0
src/main/java/com/xjrsoft/module/ledger/controller/LedgerStatisticsController.java

@@ -81,6 +81,11 @@ public class LedgerStatisticsController {
             userIdList.addAll(userList.stream().map(UserDeptRelation::getUserId).collect(Collectors.toList()));
         }
 
+        if(dto.getStartDate() != null && dto.getEndDate() != null){
+            dto.setStartTime(dto.getStartDate().atTime(0,0,0));
+            dto.setEndTime(dto.getEndDate().atTime(23,59,59));
+        }
+
         if(!userIdList.isEmpty()){
             dto.setUserIds(userIdList);
         }

+ 9 - 0
src/main/java/com/xjrsoft/module/ledger/dto/LedgerStatisticsPageDto.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.List;
 
 
@@ -38,6 +39,14 @@ public class LedgerStatisticsPageDto extends PageInput {
     @ApiModelProperty("请假结束日期")
     private LocalDate endDate;
 
+    @JsonIgnore
+    @ApiModelProperty("请假开始日期")
+    private LocalDateTime startTime;
+
+    @JsonIgnore
+    @ApiModelProperty("请假结束日期")
+    private LocalDateTime endTime;
+
     @JsonIgnore
     @ApiModelProperty("用户ids")
     private List<Long> userIds;

+ 22 - 10
src/main/resources/mapper/teacher/WfTeacherleaveMapper.xml

@@ -74,12 +74,12 @@
         INNER JOIN xjr_user t2 ON t1.user_id = t2.id
         INNER JOIN xjr_workflow_form_relation t3 ON t3.form_key_value = t1.id
         WHERE t3.current_state = 'COMPLETED' AND t2.delete_mark = 0
-        <if test="dto.startDate != null and dto.endDate != null">
+        <if test="dto.startTime != null and dto.endTime != null">
             AND (
-            (t1.leave_start_time BETWEEN concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59'))
-            OR (t1.leave_end_time BETWEEN concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59'))
-            OR (t1.leave_start_time > concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59') > t1.leave_end_time)
-            OR (concat(#{dto.startDate}, '00:00:00') > t1.leave_start_time and t1.leave_end_time > concat(#{dto.endDate}, '23:59:59'))
+            (t1.leave_start_time BETWEEN #{dto.startTime} and #{dto.endTime})
+            OR (t1.leave_end_time BETWEEN #{dto.startTime} and #{dto.endTime})
+            OR (t1.leave_start_time > #{dto.startTime} and #{dto.endTime} > t1.leave_end_time)
+            OR (#{dto.startTime} > t1.leave_start_time and t1.leave_end_time > #{dto.endTime})
             )
         </if>
         <if test="dto.userIds != null and dto.userIds.size() > 0">
@@ -91,6 +91,12 @@
         <if test="dto.leaveType != null and dto.leaveType != ''">
             AND #{dto.leaveType} like concat('%', t1.leave_type, '%')
         </if>
+        <if test="dto.name != null and dto.name != ''">
+            AND t2.name like concat('%', #{dto.name}, '%')
+        </if>
+        <if test="dto.userName != null and dto.userName != ''">
+            AND t2.user_name like concat('%', #{dto.userName}, '%')
+        </if>
         GROUP BY t1.user_id,t1.leave_type
         ORDER BY t2.user_name
     </select>
@@ -106,12 +112,12 @@
         INNER JOIN xjr_user t2 ON t1.user_id = t2.id
         INNER JOIN xjr_workflow_form_relation t3 ON t3.form_key_value = t1.id
         WHERE t3.current_state = 'COMPLETED' AND t2.delete_mark = 0
-        <if test="dto.startDate != null and dto.endDate != null">
+        <if test="dto.startTime != null and dto.endTime != null">
             AND (
-            (t1.leave_start_time BETWEEN concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59'))
-            OR (t1.leave_end_time BETWEEN concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59'))
-            OR (t1.leave_start_time > concat(#{dto.startDate}, '00:00:00') and concat(#{dto.endDate}, '23:59:59') > t1.leave_end_time)
-            OR (concat(#{dto.startDate}, '00:00:00') > t1.leave_start_time and t1.leave_end_time > concat(#{dto.endDate}, '23:59:59'))
+            (t1.leave_start_time BETWEEN #{dto.startTime} and #{dto.endTime})
+            OR (t1.leave_end_time BETWEEN #{dto.startTime} and #{dto.endTime})
+            OR (t1.leave_start_time > #{dto.startTime} and #{dto.endTime} > t1.leave_end_time)
+            OR (#{dto.startTime} > t1.leave_start_time and t1.leave_end_time > #{dto.endTime})
             )
         </if>
         <if test="dto.userIds != null and dto.userIds.size() > 0">
@@ -123,6 +129,12 @@
         <if test="dto.leaveType != null and dto.leaveType != ''">
             AND #{dto.leaveType} like concat('%', t1.leave_type, '%')
         </if>
+        <if test="dto.name != null and dto.name != ''">
+            AND t2.name like concat('%', #{dto.name}, '%')
+        </if>
+        <if test="dto.userName != null and dto.userName != ''">
+            AND t2.user_name like concat('%', #{dto.userName}, '%')
+        </if>
         GROUP BY t1.user_id,t1.leave_type
         ORDER BY t2.user_name
     </select>