package kr.itn.itnhub.contact; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface ContactMapper { /** category가 null이면 전체를 구분→성명 오름차순으로 돌려준다. */ List findAll(@Param("category") String category); Contact findById(@Param("id") Long id); /** * (구분, 성명, 전화, 이메일)이 모두 같은 기존 담당자를 찾는다(전화/이메일은 null-safe * 비교). 시드·회원명단 업로드가 같은 사람을 재입력해도 중복 생성하지 않고 재사용하기 * 위한 조회다. */ Contact findMatching(@Param("category") String category, @Param("name") String name, @Param("phone") String phone, @Param("email") String email); int insert(Contact contact); int update(Contact contact); /** FK는 on delete set null이므로, 이 담당자를 가리키던 기관의 배정은 자동으로 해제된다. */ int delete(@Param("id") Long id); }