package com.dashitech.businessdata.dao;

import com.dashitech.businessdata.entity.SpecimenEntity;
import com.dashitech.businessdata.entity.SpecimenHistoryEntity;
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 2020/12/17.
 */
public interface ISpecimenHistoryDAO  extends JpaRepository<SpecimenHistoryEntity, String> {
    @SuppressWarnings("unchecked")
    SpecimenEntity save(SpecimenEntity specimen);


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