package com.sw.mes.yb.pc.dao;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.yb.pc.entity.EstimatedRecord;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface EstimatedRecordDao extends BaseDao<EstimatedRecord, Integer> {

    @Modifying
    // @Query(value = "DELETE FROM estimated_record WHERE take_time<?1 ", nativeQuery = true)
    @Query(value = "UPDATE estimated_record SET is_deleted = 1 , update_time = ?2 WHERE take_time < ?1", nativeQuery = true)
    void deleteBeforeHalfHourEstimatedRecord(Date halfHour, Date updateTime);
}