package kr.iotdoor.boot.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AtchFileMapper {

    @Insert("""
        INSERT INTO TN_ATCH_FILE (
            ATCH_FILE_IDNTF_NO,
            CRT_DT,
            DEL_YN
        ) VALUES (
            #{atchFileIdntfNo},
            CURRENT_TIMESTAMP,
            'N'
        )
        """)
    int insertAtchFile(@Param("atchFileIdntfNo") String atchFileIdntfNo);

    @Update("""
        UPDATE TN_ATCH_FILE SET
            DEL_YN = 'Y'
        WHERE ATCH_FILE_IDNTF_NO = #{atchFileIdntfNo}
        """)
    int deleteAtchFile(@Param("atchFileIdntfNo") String atchFileIdntfNo);
}
