Migrate to MyBatis with proper Controller→Service→Mapper layering

- Add MyBatis Spring Boot Starter with XML mappers and domain classes
- Create 9 mapper interfaces + XML: Restaurant, Video, Channel, Review,
  User, Stats, DaemonConfig, Search, Vector
- Create 10 domain classes with Lombok: Restaurant, VideoSummary,
  VideoDetail, VideoRestaurantLink, Channel, Review, UserInfo,
  DaemonConfig, SiteVisitStats, VectorSearchResult
- Create 7 new service classes: RestaurantService, VideoService,
  ChannelService, ReviewService, UserService, StatsService,
  DaemonConfigService
- Refactor all controllers to be thin (HTTP + auth only), delegating
  business logic to services
- Refactor SearchService, PipelineService, DaemonScheduler, AuthService,
  YouTubeService to use mappers/services instead of JDBC/repositories
- Add Jackson SNAKE_CASE property naming for consistent API responses
- Add ClobTypeHandler for Oracle CLOB→String in MyBatis
- Add IdGenerator utility for centralized UUID generation
- Delete old repository/ package (6 files), JdbcConfig, LowerCaseKeyAdvice
- VectorService retains JDBC for Oracle VECTOR type support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-09 21:13:44 +09:00
parent 91d0ad4598
commit c16add08c3
63 changed files with 2155 additions and 1483 deletions

View File

@@ -0,0 +1,68 @@
package com.tasteby.mapper;
import com.tasteby.domain.VideoDetail;
import com.tasteby.domain.VideoRestaurantLink;
import com.tasteby.domain.VideoSummary;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface VideoMapper {
List<VideoSummary> findAll(@Param("status") String status);
VideoDetail findDetail(@Param("id") String id);
List<VideoRestaurantLink> findVideoRestaurants(@Param("videoId") String videoId);
void updateStatus(@Param("id") String id, @Param("status") String status);
void updateTitle(@Param("id") String id, @Param("title") String title);
void updateTranscript(@Param("id") String id, @Param("transcript") String transcript);
void deleteVectorsByVideoOnly(@Param("videoId") String videoId);
void deleteReviewsByVideoOnly(@Param("videoId") String videoId);
void deleteFavoritesByVideoOnly(@Param("videoId") String videoId);
void deleteRestaurantsByVideoOnly(@Param("videoId") String videoId);
void deleteVideoRestaurants(@Param("videoId") String videoId);
void deleteVideo(@Param("videoId") String videoId);
void deleteOneVideoRestaurant(@Param("videoId") String videoId, @Param("restaurantId") String restaurantId);
void cleanupOrphanVectors(@Param("restaurantId") String restaurantId);
void cleanupOrphanReviews(@Param("restaurantId") String restaurantId);
void cleanupOrphanFavorites(@Param("restaurantId") String restaurantId);
void cleanupOrphanRestaurant(@Param("restaurantId") String restaurantId);
void insertVideo(@Param("id") String id,
@Param("channelId") String channelId,
@Param("videoId") String videoId,
@Param("title") String title,
@Param("url") String url,
@Param("publishedAt") String publishedAt);
List<String> getExistingVideoIds(@Param("channelId") String channelId);
String getLatestVideoDate(@Param("channelId") String channelId);
List<Map<String, Object>> findPendingVideos(@Param("limit") int limit);
void updateVideoFields(@Param("id") String id,
@Param("status") String status,
@Param("transcript") String transcript,
@Param("llmResponse") String llmResponse);
List<Map<String, Object>> findVideosForBulkExtract();
}