package com.malk.fengkaili.repository.dao;

import com.malk.fengkaili.repository.entity.FKLDdContactPo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.Date;

/**
 * 钉钉花名册同步
 */
@Transactional
public interface FKLDdContactDao extends JpaRepository<FKLDdContactPo, Long>, JpaSpecificationExecutor<FKLDdContactPo> {

    FKLDdContactPo findByUserId(String userId);

    @Modifying
    @Query("update FKLDdContactPo set leaveDate = ?2 where userId = ?1")
    void updateLeaveDate(String userId, Date leaveDate);
}
