package com.dashitech.businessdata.dao;

import com.dashitech.businessdata.entity.PatientLogEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by xuweihua on 2021/1/13.
 */
public interface IPatientLogDAO extends JpaRepository<PatientLogEntity, String> {
    @SuppressWarnings("unchecked")
    PatientLogEntity save(PatientLogEntity patientLogEntity);

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM itsm_patient_log WHERE time < date_add(now(),interval-1 month)",nativeQuery = true)
    int deletePatientLog();
}
