package com.ywt.domain.entity.center;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface OrderRemarkInformRepository extends JpaRepository<OrderRemarkInform, Integer> {

    /**
     * 根据orderId和备注的内容判断最近是否有相同的备注消息提醒
     *
     * @param orderId 订单ID
     * @return {@link OrderRemarkInform}
     */
    @Query(value = "select count(1) from order_remark_inform where order_id = ? and content = ? and type = ? order by id desc limit 1;", nativeQuery = true)
    int checkLeastOrderRemark(int orderId, String remark, int type);
}
