
package com.usky.meeting.repository;

import com.usky.meeting.domain.MeetingAttendee;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
*
* @author zyj
* @date 2024-03-13
**/
public interface MeetingAttendeeRepository extends JpaRepository<MeetingAttendee, String>, JpaSpecificationExecutor<MeetingAttendee> {
    @Query(value = "SELECT a.* FROM meeting_attendee a WHERE a.tenant_id = :tenantId " +
            "and if(:meetingId != '',a.meeting_id = :meetingId,1=1)" + "and if(:userId != '',a.user_id = :userId,1=1)",nativeQuery = true)
    List<MeetingAttendee> findMeetingAttendeeList(@Param("meetingId") Long meetingId, @Param("userId") Long userId, @Param("tenantId") Integer tenantId);

}