package kr.itn.itnhub.review; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface ReviewItemMapper { /** 순번 오름차순, keyword는 사이트명/게시판명/게시물제목 LIKE. keyword가 null이면 필터 없음. */ List findPage(@Param("orgId") Long orgId, @Param("keyword") String keyword, @Param("offset") int offset, @Param("limit") int limit); int countByOrg(@Param("orgId") Long orgId, @Param("keyword") String keyword); /** 처리결과(review_result)가 채워진 행 수 - 검색어와 무관한 기관 전체 진행률. */ int countDone(@Param("orgId") Long orgId); /** 다운로드/재업로드 판정용으로 페이징 없이 순번순 전체를 읽는다. */ List findAllByOrg(@Param("orgId") Long orgId); /** 이미 저장된 순번 전체 - SeedService처럼 신규/갱신 집계를 메모리에서 판단하기 위함. */ List findSeqsByOrg(@Param("orgId") Long orgId); ReviewItem findById(@Param("orgId") Long orgId, @Param("id") Long id); /** * 엑셀 재업로드 1행 반영. (org_id, seq) 충돌 시 조사원 영역은 항상 덮어쓰고, * 변호사 영역은 web_edited_at이 null일 때만 덮어쓴다 - 정책 세부는 XML 주석 참고. */ int upsertFromFile(ReviewItem item); int updateJudgment(@Param("orgId") Long orgId, @Param("id") Long id, @Param("openable") String openable, @Param("reviewMajor") String reviewMajor, @Param("reviewMinor") String reviewMinor, @Param("reviewResult") String reviewResult, @Param("judgedKoglType") String judgedKoglType, @Param("judgedAiType") String judgedAiType, @Param("opinion") String opinion, @Param("lawyerNote") String lawyerNote, @Param("needsProcessing") String needsProcessing); int deleteById(@Param("orgId") Long orgId, @Param("id") Long id); /** 기관 삭제 캐스케이드 외에는 아직 쓰이지 않지만, 저장 비용이 낮아 함께 둔다. */ int deleteByOrg(@Param("orgId") Long orgId); }