package com.nursinghome.mapper;

import com.nursinghome.entity.Handover;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface HandoverMapper {
    @Insert("INSERT INTO handover(nurse_id, date, content, created_at) VALUES(#{nurseId}, #{date}, #{content}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(Handover handover);

    @Select("SELECT * FROM handover WHERE nurse_id = #{nurseId} ORDER BY date DESC")
    List<Handover> listByNurseId(Long nurseId);
}
