weicd
2023-01-12 9d83678dab15c3dffdaf701dcc248665a7849fc7
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceGoOutRepository.java
@@ -17,10 +17,12 @@
import me.zhengjie.modules.attendance.domain.AttendanceGoOut;
import me.zhengjie.modules.attendance.domain.AttendanceLeave;
import me.zhengjie.modules.system.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
@@ -40,4 +42,8 @@
    @Query(value = "SELECT * FROM attendance_go_out WHERE user_id = ?3 AND approval_status IN ('go_out_approve_status_reviewed', 'go_out_approve_status_agree') AND id NOT IN ?4 AND ((out_start_time >= ?1 and out_start_time <= ?2) OR \n" +
            "(out_start_time <= ?1 and out_end_time >= ?2) OR (out_end_time >= ?1 and out_end_time <= ?2) OR (out_start_time >= ?1 and out_end_time <= ?2))", nativeQuery = true)
    List<AttendanceGoOut> checkCreateUpdateTime(String startTime, String endTime, Long userId, Set<Long> ids);
    // 查询外出记录
    @Query(value = "SELECT * from attendance_go_out where user_id = ?1 and out_start_time <= ?3 and out_end_time >= ?2 and approval_status in ('go_out_approve_status_agree')", nativeQuery = true)
    List<AttendanceGoOut> findByUserAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate);
}