From aa09798e38c4d5b03e06dd1ca361e21d40885c88 Mon Sep 17 00:00:00 2001 From: essential2189 Date: Mon, 22 Jan 2024 01:29:08 +0900 Subject: [PATCH] fix: sido & sigungu & lat & lng --- database/ddl.sql | 18 +- database/initdb.d/init.sql | 468 +++--------------- .../todaypopup/core/model/PopupEntity.java | 8 +- .../core/model/PopupInfoEntity.java | 6 + .../{RegionEntity.java => SidoEntity.java} | 18 +- .../todaypopup/core/model/SigunguEntity.java | 31 ++ .../popup/dto/GetPopupDetailResponseDto.java | 4 +- .../domain/popup/dto/GetPopupsRequestDto.java | 3 +- .../popup/dto/GetPopupsResponseDto.java | 2 +- .../domain/popup/dto/LocationDto.java | 14 + .../popup/repository/PopupRepositoryImpl.java | 7 +- .../popup/service/PopupServiceImpl.java | 18 +- .../region/controller/RegionController.java | 5 +- .../region/dto/GetRegionInfoRequestDto.java | 2 +- .../region/dto/GetRegionInfoResponseDto.java | 7 +- .../domain/region/dto/SigunguDto.java | 14 + .../region/repository/RegionRepository.java | 15 - .../region/repository/SidoRepository.java | 8 + .../region/repository/SigunguRepository.java | 10 + .../domain/region/service/RegionService.java | 3 +- .../region/service/RegionServiceImpl.java | 56 ++- src/main/resources/application-dev.yaml | 25 + src/main/resources/application.properties | 4 - src/main/resources/application.yaml | 12 + 24 files changed, 287 insertions(+), 471 deletions(-) rename src/main/java/com/todaypopup/todaypopup/core/model/{RegionEntity.java => SidoEntity.java} (57%) create mode 100644 src/main/java/com/todaypopup/todaypopup/core/model/SigunguEntity.java create mode 100644 src/main/java/com/todaypopup/todaypopup/domain/popup/dto/LocationDto.java create mode 100644 src/main/java/com/todaypopup/todaypopup/domain/region/dto/SigunguDto.java delete mode 100644 src/main/java/com/todaypopup/todaypopup/domain/region/repository/RegionRepository.java create mode 100644 src/main/java/com/todaypopup/todaypopup/domain/region/repository/SidoRepository.java create mode 100644 src/main/java/com/todaypopup/todaypopup/domain/region/repository/SigunguRepository.java create mode 100644 src/main/resources/application-dev.yaml delete mode 100644 src/main/resources/application.properties diff --git a/database/ddl.sql b/database/ddl.sql index 843d3f7..b8775df 100644 --- a/database/ddl.sql +++ b/database/ddl.sql @@ -5,7 +5,8 @@ CREATE TABLE IF NOT EXISTS `popup` ( `start_date` DATE NULL COMMENT '팝업 시작일', `end_date` DATE NULL COMMENT '팝업 종료일', `category_id` INT NOT NULL COMMENT '카테고리 ID', - `region_id` INT NOT NULL COMMENT '지역 ID', + `sido_id` INT NOT NULL COMMENT '시/도 ID', + `sigungu_id` INT NOT NULL COMMENT '시/군/구 ID', `info_id` BIGINT NOT NULL COMMENT '팝업 상세 정보 ID', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP @@ -18,10 +19,17 @@ CREATE TABLE IF NOT EXISTS `category` ( `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); -CREATE TABLE IF NOT EXISTS `region` ( +CREATE TABLE IF NOT EXISTS `sido` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `sido` VARCHAR(50) NOT NULL COMMENT '시/도', - `sigungu` VARCHAR(50) NOT NULL COMMENT '시/군/구', + `name` VARCHAR(50) NOT NULL COMMENT '시/도', + `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS `sigungu` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(50) NOT NULL COMMENT '시/군/구', + `sido_id` VARCHAR(50) NOT NULL COMMENT '시/도 ID', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); @@ -39,6 +47,8 @@ CREATE TABLE IF NOT EXISTS `popup_info` ( `url_link` TEXT NULL COMMENT '공식 URL 링크 (홈페이지, 인스타 등)', `introduction` TEXT NULL COMMENT '소개', `address` TEXT NULL COMMENT '주소', + `lat` TEXT NULL COMMENT '위도', + `lng` TEXT NULL COMMENT '경도', `start_time` TIME NULL COMMENT '시작 시간', `end_time` TIME NULL COMMENT '종료 시간', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, diff --git a/database/initdb.d/init.sql b/database/initdb.d/init.sql index b404736..6512cc5 100644 --- a/database/initdb.d/init.sql +++ b/database/initdb.d/init.sql @@ -9,7 +9,8 @@ CREATE TABLE IF NOT EXISTS `popup` ( `start_date` DATE NULL COMMENT '팝업 시작일', `end_date` DATE NULL COMMENT '팝업 종료일', `category_id` INT NOT NULL COMMENT '카테고리 ID', - `region_id` INT NOT NULL COMMENT '지역 ID', + `sido_id` INT NOT NULL COMMENT '시/도 ID', + `sigungu_id` INT NOT NULL COMMENT '시/군/구 ID', `info_id` BIGINT NOT NULL COMMENT '팝업 상세 정보 ID', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP @@ -22,10 +23,17 @@ CREATE TABLE IF NOT EXISTS `category` ( `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); -CREATE TABLE IF NOT EXISTS `region` ( +CREATE TABLE IF NOT EXISTS `sido` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `sido` VARCHAR(50) NOT NULL COMMENT '시/도', - `sigungu` VARCHAR(50) NOT NULL COMMENT '시/군/구', + `name` VARCHAR(50) NOT NULL COMMENT '시/도', + `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS `sigungu` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(50) NOT NULL COMMENT '시/군/구', + `sido_id` VARCHAR(50) NOT NULL COMMENT '시/도 ID', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); @@ -43,421 +51,61 @@ CREATE TABLE IF NOT EXISTS `popup_info` ( `url_link` TEXT NULL COMMENT '공식 URL 링크 (홈페이지, 인스타 등)', `introduction` TEXT NULL COMMENT '소개', `address` TEXT NULL COMMENT '주소', + `lat` TEXT NULL COMMENT '위도', + `lng` TEXT NULL COMMENT '경도', `start_time` TIME NULL COMMENT '시작 시간', `end_time` TIME NULL COMMENT '종료 시간', `create_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `update_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); - INSERT INTO category (id, name) VALUES (1, '팝업'), (2, '전시회'), (3, '공연'), (4, '페스티벌'); -INSERT INTO region (id, sido, sigungu) VALUES (1, '서울', '강남구'), (2, '서울', '강동구'), (3, '서울', '강북구'), (4, '서울', '강서구'), (5, '서울', '관악구'), (6, '서울', '광진구'), (7, '서울', '구로구'), (8, '서울', '금천구'), (9, '서울', '노원구'), (10, '서울', '도봉구'), (11, '서울', '동대문구'), (12, '서울', '동작구'), (13, '서울', '마포구'), (14, '서울', '서대문구'), (15, '서울', '서초구'), (16, '서울', '성동구'), (17, '서울', '성북구'), (18, '서울', '송파구'), (19, '서울', '양천구'), (20, '서울', '영등포구'), (21, '서울', '용산구'), (22, '서울', '은평구'), (23, '서울', '종로구'), (24, '서울', '중구'), (25, '서울', '중랑구'); - - -INSERT INTO `popup_info` (id, url_link, introduction, address, start_time, end_time) VALUES -(1, 'http://example.com/info1', 'Introduction 1', 'Address 1', '09:00:00', '18:00:00'), -(2, 'http://example.com/info2', 'Introduction 2', 'Address 2', '09:00:00', '18:00:00'), -(3, 'http://example.com/info3', 'Introduction 3', 'Address 3', '09:00:00', '18:00:00'), -(4, 'http://example.com/info4', 'Introduction 4', 'Address 4', '09:00:00', '18:00:00'), -(5, 'http://example.com/info5', 'Introduction 5', 'Address 5', '09:00:00', '18:00:00'), -(6, 'http://example.com/info6', 'Introduction 6', 'Address 6', '09:00:00', '18:00:00'), -(7, 'http://example.com/info7', 'Introduction 7', 'Address 7', '09:00:00', '18:00:00'), -(8, 'http://example.com/info8', 'Introduction 8', 'Address 8', '09:00:00', '18:00:00'), -(9, 'http://example.com/info9', 'Introduction 9', 'Address 9', '09:00:00', '18:00:00'), -(10, 'http://example.com/info10', 'Introduction 10', 'Address 10', '09:00:00', '18:00:00'), -(11, 'http://example.com/info11', 'Introduction 11', 'Address 11', '09:00:00', '18:00:00'), -(12, 'http://example.com/info12', 'Introduction 12', 'Address 12', '09:00:00', '18:00:00'), -(13, 'http://example.com/info13', 'Introduction 13', 'Address 13', '09:00:00', '18:00:00'), -(14, 'http://example.com/info14', 'Introduction 14', 'Address 14', '09:00:00', '18:00:00'), -(15, 'http://example.com/info15', 'Introduction 15', 'Address 15', '09:00:00', '18:00:00'), -(16, 'http://example.com/info16', 'Introduction 16', 'Address 16', '09:00:00', '18:00:00'), -(17, 'http://example.com/info17', 'Introduction 17', 'Address 17', '09:00:00', '18:00:00'), -(18, 'http://example.com/info18', 'Introduction 18', 'Address 18', '09:00:00', '18:00:00'), -(19, 'http://example.com/info19', 'Introduction 19', 'Address 19', '09:00:00', '18:00:00'), -(20, 'http://example.com/info20', 'Introduction 20', 'Address 20', '09:00:00', '18:00:00'), -(21, 'http://example.com/info21', 'Introduction 21', 'Address 21', '09:00:00', '18:00:00'), -(22, 'http://example.com/info22', 'Introduction 22', 'Address 22', '09:00:00', '18:00:00'), -(23, 'http://example.com/info23', 'Introduction 23', 'Address 23', '09:00:00', '18:00:00'), -(24, 'http://example.com/info24', 'Introduction 24', 'Address 24', '09:00:00', '18:00:00'), -(25, 'http://example.com/info25', 'Introduction 25', 'Address 25', '09:00:00', '18:00:00'), -(26, 'http://example.com/info26', 'Introduction 26', 'Address 26', '09:00:00', '18:00:00'), -(27, 'http://example.com/info27', 'Introduction 27', 'Address 27', '09:00:00', '18:00:00'), -(28, 'http://example.com/info28', 'Introduction 28', 'Address 28', '09:00:00', '18:00:00'), -(29, 'http://example.com/info29', 'Introduction 29', 'Address 29', '09:00:00', '18:00:00'), -(30, 'http://example.com/info30', 'Introduction 30', 'Address 30', '09:00:00', '18:00:00'), -(31, 'http://example.com/info31', 'Introduction 31', 'Address 31', '09:00:00', '18:00:00'), -(32, 'http://example.com/info32', 'Introduction 32', 'Address 32', '09:00:00', '18:00:00'), -(33, 'http://example.com/info33', 'Introduction 33', 'Address 33', '09:00:00', '18:00:00'), -(34, 'http://example.com/info34', 'Introduction 34', 'Address 34', '09:00:00', '18:00:00'), -(35, 'http://example.com/info35', 'Introduction 35', 'Address 35', '09:00:00', '18:00:00'), -(36, 'http://example.com/info36', 'Introduction 36', 'Address 36', '09:00:00', '18:00:00'), -(37, 'http://example.com/info37', 'Introduction 37', 'Address 37', '09:00:00', '18:00:00'), -(38, 'http://example.com/info38', 'Introduction 38', 'Address 38', '09:00:00', '18:00:00'), -(39, 'http://example.com/info39', 'Introduction 39', 'Address 39', '09:00:00', '18:00:00'), -(40, 'http://example.com/info40', 'Introduction 40', 'Address 40', '09:00:00', '18:00:00'), -(41, 'http://example.com/info41', 'Introduction 41', 'Address 41', '09:00:00', '18:00:00'), -(42, 'http://example.com/info42', 'Introduction 42', 'Address 42', '09:00:00', '18:00:00'), -(43, 'http://example.com/info43', 'Introduction 43', 'Address 43', '09:00:00', '18:00:00'), -(44, 'http://example.com/info44', 'Introduction 44', 'Address 44', '09:00:00', '18:00:00'), -(45, 'http://example.com/info45', 'Introduction 45', 'Address 45', '09:00:00', '18:00:00'), -(46, 'http://example.com/info46', 'Introduction 46', 'Address 46', '09:00:00', '18:00:00'), -(47, 'http://example.com/info47', 'Introduction 47', 'Address 47', '09:00:00', '18:00:00'), -(48, 'http://example.com/info48', 'Introduction 48', 'Address 48', '09:00:00', '18:00:00'), -(49, 'http://example.com/info49', 'Introduction 49', 'Address 49', '09:00:00', '18:00:00'), -(50, 'http://example.com/info50', 'Introduction 50', 'Address 50', '09:00:00', '18:00:00'), -(51, 'http://example.com/info51', 'Introduction 51', 'Address 51', '09:00:00', '18:00:00'), -(52, 'http://example.com/info52', 'Introduction 52', 'Address 52', '09:00:00', '18:00:00'), -(53, 'http://example.com/info53', 'Introduction 53', 'Address 53', '09:00:00', '18:00:00'), -(54, 'http://example.com/info54', 'Introduction 54', 'Address 54', '09:00:00', '18:00:00'), -(55, 'http://example.com/info55', 'Introduction 55', 'Address 55', '09:00:00', '18:00:00'), -(56, 'http://example.com/info56', 'Introduction 56', 'Address 56', '09:00:00', '18:00:00'), -(57, 'http://example.com/info57', 'Introduction 57', 'Address 57', '09:00:00', '18:00:00'), -(58, 'http://example.com/info58', 'Introduction 58', 'Address 58', '09:00:00', '18:00:00'), -(59, 'http://example.com/info59', 'Introduction 59', 'Address 59', '09:00:00', '18:00:00'), -(60, 'http://example.com/info60', 'Introduction 60', 'Address 60', '09:00:00', '18:00:00'), -(61, 'http://example.com/info61', 'Introduction 61', 'Address 61', '09:00:00', '18:00:00'), -(62, 'http://example.com/info62', 'Introduction 62', 'Address 62', '09:00:00', '18:00:00'), -(63, 'http://example.com/info63', 'Introduction 63', 'Address 63', '09:00:00', '18:00:00'), -(64, 'http://example.com/info64', 'Introduction 64', 'Address 64', '09:00:00', '18:00:00'), -(65, 'http://example.com/info65', 'Introduction 65', 'Address 65', '09:00:00', '18:00:00'), -(66, 'http://example.com/info66', 'Introduction 66', 'Address 66', '09:00:00', '18:00:00'), -(67, 'http://example.com/info67', 'Introduction 67', 'Address 67', '09:00:00', '18:00:00'), -(68, 'http://example.com/info68', 'Introduction 68', 'Address 68', '09:00:00', '18:00:00'), -(69, 'http://example.com/info69', 'Introduction 69', 'Address 69', '09:00:00', '18:00:00'), -(70, 'http://example.com/info70', 'Introduction 70', 'Address 70', '09:00:00', '18:00:00'), -(71, 'http://example.com/info71', 'Introduction 71', 'Address 71', '09:00:00', '18:00:00'), -(72, 'http://example.com/info72', 'Introduction 72', 'Address 72', '09:00:00', '18:00:00'), -(73, 'http://example.com/info73', 'Introduction 73', 'Address 73', '09:00:00', '18:00:00'), -(74, 'http://example.com/info74', 'Introduction 74', 'Address 74', '09:00:00', '18:00:00'), -(75, 'http://example.com/info75', 'Introduction 75', 'Address 75', '09:00:00', '18:00:00'), -(76, 'http://example.com/info76', 'Introduction 76', 'Address 76', '09:00:00', '18:00:00'), -(77, 'http://example.com/info77', 'Introduction 77', 'Address 77', '09:00:00', '18:00:00'), -(78, 'http://example.com/info78', 'Introduction 78', 'Address 78', '09:00:00', '18:00:00'), -(79, 'http://example.com/info79', 'Introduction 79', 'Address 79', '09:00:00', '18:00:00'), -(80, 'http://example.com/info80', 'Introduction 80', 'Address 80', '09:00:00', '18:00:00'), -(81, 'http://example.com/info81', 'Introduction 81', 'Address 81', '09:00:00', '18:00:00'), -(82, 'http://example.com/info82', 'Introduction 82', 'Address 82', '09:00:00', '18:00:00'), -(83, 'http://example.com/info83', 'Introduction 83', 'Address 83', '09:00:00', '18:00:00'), -(84, 'http://example.com/info84', 'Introduction 84', 'Address 84', '09:00:00', '18:00:00'), -(85, 'http://example.com/info85', 'Introduction 85', 'Address 85', '09:00:00', '18:00:00'), -(86, 'http://example.com/info86', 'Introduction 86', 'Address 86', '09:00:00', '18:00:00'), -(87, 'http://example.com/info87', 'Introduction 87', 'Address 87', '09:00:00', '18:00:00'), -(88, 'http://example.com/info88', 'Introduction 88', 'Address 88', '09:00:00', '18:00:00'), -(89, 'http://example.com/info89', 'Introduction 89', 'Address 89', '09:00:00', '18:00:00'), -(90, 'http://example.com/info90', 'Introduction 90', 'Address 90', '09:00:00', '18:00:00'), -(91, 'http://example.com/info91', 'Introduction 91', 'Address 91', '09:00:00', '18:00:00'), -(92, 'http://example.com/info92', 'Introduction 92', 'Address 92', '09:00:00', '18:00:00'), -(93, 'http://example.com/info93', 'Introduction 93', 'Address 93', '09:00:00', '18:00:00'), -(94, 'http://example.com/info94', 'Introduction 94', 'Address 94', '09:00:00', '18:00:00'), -(95, 'http://example.com/info95', 'Introduction 95', 'Address 95', '09:00:00', '18:00:00'), -(96, 'http://example.com/info96', 'Introduction 96', 'Address 96', '09:00:00', '18:00:00'), -(97, 'http://example.com/info97', 'Introduction 97', 'Address 97', '09:00:00', '18:00:00'), -(98, 'http://example.com/info98', 'Introduction 98', 'Address 98', '09:00:00', '18:00:00'), -(99, 'http://example.com/info99', 'Introduction 99', 'Address 99', '09:00:00', '18:00:00'), -(100, 'http://example.com/info100', 'Introduction 100', 'Address 100', '09:00:00', '18:00:00'), -(101, 'http://example.com/info101', 'Introduction 101', 'Address 101', '09:00:00', '18:00:00'), -(102, 'http://example.com/info102', 'Introduction 102', 'Address 102', '09:00:00', '18:00:00'), -(103, 'http://example.com/info103', 'Introduction 103', 'Address 103', '09:00:00', '18:00:00'), -(104, 'http://example.com/info104', 'Introduction 104', 'Address 104', '09:00:00', '18:00:00'), -(105, 'http://example.com/info105', 'Introduction 105', 'Address 105', '09:00:00', '18:00:00'), -(106, 'http://example.com/info106', 'Introduction 106', 'Address 106', '09:00:00', '18:00:00'), -(107, 'http://example.com/info107', 'Introduction 107', 'Address 107', '09:00:00', '18:00:00'), -(108, 'http://example.com/info108', 'Introduction 108', 'Address 108', '09:00:00', '18:00:00'), -(109, 'http://example.com/info109', 'Introduction 109', 'Address 109', '09:00:00', '18:00:00'), -(110, 'http://example.com/info110', 'Introduction 110', 'Address 110', '09:00:00', '18:00:00'), -(111, 'http://example.com/info111', 'Introduction 111', 'Address 111', '09:00:00', '18:00:00'), -(112, 'http://example.com/info112', 'Introduction 112', 'Address 112', '09:00:00', '18:00:00'), -(113, 'http://example.com/info113', 'Introduction 113', 'Address 113', '09:00:00', '18:00:00'), -(114, 'http://example.com/info114', 'Introduction 114', 'Address 114', '09:00:00', '18:00:00'), -(115, 'http://example.com/info115', 'Introduction 115', 'Address 115', '09:00:00', '18:00:00'), -(116, 'http://example.com/info116', 'Introduction 116', 'Address 116', '09:00:00', '18:00:00'), -(117, 'http://example.com/info117', 'Introduction 117', 'Address 117', '09:00:00', '18:00:00'), -(118, 'http://example.com/info118', 'Introduction 118', 'Address 118', '09:00:00', '18:00:00'), -(119, 'http://example.com/info119', 'Introduction 119', 'Address 119', '09:00:00', '18:00:00'), -(120, 'http://example.com/info120', 'Introduction 120', 'Address 120', '09:00:00', '18:00:00'), -(121, 'http://example.com/info121', 'Introduction 121', 'Address 121', '09:00:00', '18:00:00'), -(122, 'http://example.com/info122', 'Introduction 122', 'Address 122', '09:00:00', '18:00:00'), -(123, 'http://example.com/info123', 'Introduction 123', 'Address 123', '09:00:00', '18:00:00'), -(124, 'http://example.com/info124', 'Introduction 124', 'Address 124', '09:00:00', '18:00:00'), -(125, 'http://example.com/info125', 'Introduction 125', 'Address 125', '09:00:00', '18:00:00'), -(126, 'http://example.com/info126', 'Introduction 126', 'Address 126', '09:00:00', '18:00:00'), -(127, 'http://example.com/info127', 'Introduction 127', 'Address 127', '09:00:00', '18:00:00'), -(128, 'http://example.com/info128', 'Introduction 128', 'Address 128', '09:00:00', '18:00:00'), -(129, 'http://example.com/info129', 'Introduction 129', 'Address 129', '09:00:00', '18:00:00'), -(130, 'http://example.com/info130', 'Introduction 130', 'Address 130', '09:00:00', '18:00:00'), -(131, 'http://example.com/info131', 'Introduction 131', 'Address 131', '09:00:00', '18:00:00'), -(132, 'http://example.com/info132', 'Introduction 132', 'Address 132', '09:00:00', '18:00:00'), -(133, 'http://example.com/info133', 'Introduction 133', 'Address 133', '09:00:00', '18:00:00'), -(134, 'http://example.com/info134', 'Introduction 134', 'Address 134', '09:00:00', '18:00:00'), -(135, 'http://example.com/info135', 'Introduction 135', 'Address 135', '09:00:00', '18:00:00'), -(136, 'http://example.com/info136', 'Introduction 136', 'Address 136', '09:00:00', '18:00:00'), -(137, 'http://example.com/info137', 'Introduction 137', 'Address 137', '09:00:00', '18:00:00'), -(138, 'http://example.com/info138', 'Introduction 138', 'Address 138', '09:00:00', '18:00:00'), -(139, 'http://example.com/info139', 'Introduction 139', 'Address 139', '09:00:00', '18:00:00'), -(140, 'http://example.com/info140', 'Introduction 140', 'Address 140', '09:00:00', '18:00:00'), -(141, 'http://example.com/info141', 'Introduction 141', 'Address 141', '09:00:00', '18:00:00'), -(142, 'http://example.com/info142', 'Introduction 142', 'Address 142', '09:00:00', '18:00:00'), -(143, 'http://example.com/info143', 'Introduction 143', 'Address 143', '09:00:00', '18:00:00'), -(144, 'http://example.com/info144', 'Introduction 144', 'Address 144', '09:00:00', '18:00:00'), -(145, 'http://example.com/info145', 'Introduction 145', 'Address 145', '09:00:00', '18:00:00'), -(146, 'http://example.com/info146', 'Introduction 146', 'Address 146', '09:00:00', '18:00:00'), -(147, 'http://example.com/info147', 'Introduction 147', 'Address 147', '09:00:00', '18:00:00'), -(148, 'http://example.com/info148', 'Introduction 148', 'Address 148', '09:00:00', '18:00:00'), -(149, 'http://example.com/info149', 'Introduction 149', 'Address 149', '09:00:00', '18:00:00'), -(150, 'http://example.com/info150', 'Introduction 150', 'Address 150', '09:00:00', '18:00:00'), -(151, 'http://example.com/info151', 'Introduction 151', 'Address 151', '09:00:00', '18:00:00'), -(152, 'http://example.com/info152', 'Introduction 152', 'Address 152', '09:00:00', '18:00:00'), -(153, 'http://example.com/info153', 'Introduction 153', 'Address 153', '09:00:00', '18:00:00'), -(154, 'http://example.com/info154', 'Introduction 154', 'Address 154', '09:00:00', '18:00:00'), -(155, 'http://example.com/info155', 'Introduction 155', 'Address 155', '09:00:00', '18:00:00'), -(156, 'http://example.com/info156', 'Introduction 156', 'Address 156', '09:00:00', '18:00:00'), -(157, 'http://example.com/info157', 'Introduction 157', 'Address 157', '09:00:00', '18:00:00'), -(158, 'http://example.com/info158', 'Introduction 158', 'Address 158', '09:00:00', '18:00:00'), -(159, 'http://example.com/info159', 'Introduction 159', 'Address 159', '09:00:00', '18:00:00'), -(160, 'http://example.com/info160', 'Introduction 160', 'Address 160', '09:00:00', '18:00:00'), -(161, 'http://example.com/info161', 'Introduction 161', 'Address 161', '09:00:00', '18:00:00'), -(162, 'http://example.com/info162', 'Introduction 162', 'Address 162', '09:00:00', '18:00:00'), -(163, 'http://example.com/info163', 'Introduction 163', 'Address 163', '09:00:00', '18:00:00'), -(164, 'http://example.com/info164', 'Introduction 164', 'Address 164', '09:00:00', '18:00:00'), -(165, 'http://example.com/info165', 'Introduction 165', 'Address 165', '09:00:00', '18:00:00'), -(166, 'http://example.com/info166', 'Introduction 166', 'Address 166', '09:00:00', '18:00:00'), -(167, 'http://example.com/info167', 'Introduction 167', 'Address 167', '09:00:00', '18:00:00'), -(168, 'http://example.com/info168', 'Introduction 168', 'Address 168', '09:00:00', '18:00:00'), -(169, 'http://example.com/info169', 'Introduction 169', 'Address 169', '09:00:00', '18:00:00'), -(170, 'http://example.com/info170', 'Introduction 170', 'Address 170', '09:00:00', '18:00:00'), -(171, 'http://example.com/info171', 'Introduction 171', 'Address 171', '09:00:00', '18:00:00'), -(172, 'http://example.com/info172', 'Introduction 172', 'Address 172', '09:00:00', '18:00:00'), -(173, 'http://example.com/info173', 'Introduction 173', 'Address 173', '09:00:00', '18:00:00'), -(174, 'http://example.com/info174', 'Introduction 174', 'Address 174', '09:00:00', '18:00:00'), -(175, 'http://example.com/info175', 'Introduction 175', 'Address 175', '09:00:00', '18:00:00'), -(176, 'http://example.com/info176', 'Introduction 176', 'Address 176', '09:00:00', '18:00:00'), -(177, 'http://example.com/info177', 'Introduction 177', 'Address 177', '09:00:00', '18:00:00'), -(178, 'http://example.com/info178', 'Introduction 178', 'Address 178', '09:00:00', '18:00:00'), -(179, 'http://example.com/info179', 'Introduction 179', 'Address 179', '09:00:00', '18:00:00'), -(180, 'http://example.com/info180', 'Introduction 180', 'Address 180', '09:00:00', '18:00:00'), -(181, 'http://example.com/info181', 'Introduction 181', 'Address 181', '09:00:00', '18:00:00'), -(182, 'http://example.com/info182', 'Introduction 182', 'Address 182', '09:00:00', '18:00:00'), -(183, 'http://example.com/info183', 'Introduction 183', 'Address 183', '09:00:00', '18:00:00'), -(184, 'http://example.com/info184', 'Introduction 184', 'Address 184', '09:00:00', '18:00:00'), -(185, 'http://example.com/info185', 'Introduction 185', 'Address 185', '09:00:00', '18:00:00'), -(186, 'http://example.com/info186', 'Introduction 186', 'Address 186', '09:00:00', '18:00:00'), -(187, 'http://example.com/info187', 'Introduction 187', 'Address 187', '09:00:00', '18:00:00'), -(188, 'http://example.com/info188', 'Introduction 188', 'Address 188', '09:00:00', '18:00:00'), -(189, 'http://example.com/info189', 'Introduction 189', 'Address 189', '09:00:00', '18:00:00'), -(190, 'http://example.com/info190', 'Introduction 190', 'Address 190', '09:00:00', '18:00:00'), -(191, 'http://example.com/info191', 'Introduction 191', 'Address 191', '09:00:00', '18:00:00'), -(192, 'http://example.com/info192', 'Introduction 192', 'Address 192', '09:00:00', '18:00:00'), -(193, 'http://example.com/info193', 'Introduction 193', 'Address 193', '09:00:00', '18:00:00'), -(194, 'http://example.com/info194', 'Introduction 194', 'Address 194', '09:00:00', '18:00:00'), -(195, 'http://example.com/info195', 'Introduction 195', 'Address 195', '09:00:00', '18:00:00'), -(196, 'http://example.com/info196', 'Introduction 196', 'Address 196', '09:00:00', '18:00:00'), -(197, 'http://example.com/info197', 'Introduction 197', 'Address 197', '09:00:00', '18:00:00'), -(198, 'http://example.com/info198', 'Introduction 198', 'Address 198', '09:00:00', '18:00:00'), -(199, 'http://example.com/info199', 'Introduction 199', 'Address 199', '09:00:00', '18:00:00'), -(200, 'http://example.com/info200', 'Introduction 200', 'Address 200', '09:00:00', '18:00:00'); +INSERT INTO sido (name) VALUES ('서울특별시'), ('부산광역시'), ('대구광역시'), ('인천광역시'), ('광주광역시'), ('대전광역시'), ('울산광역시'), ('세종특별자치시'), ('경기도'), ('강원도'), ('충청북도'), ('충청남도'), ('전라북도'), ('전라남도'), ('경상북도'), ('경상남도'), ('제주특별자치도'); +INSERT INTO sigungu (name, sido_id) VALUES ('강남구', 1), ('강동구', 1), ('강북구', 1), ('강서구', 1), ('관악구', 1), ('광진구', 1), ('구로구', 1), ('금천구', 1), ('노원구', 1), ('도봉구', 1), ('동대문구', 1), ('동작구', 1), ('마포구', 1), ('서대문구', 1), ('서초구', 1), ('성동구', 1), ('성북구', 1), ('송파구', 1), ('양천구', 1), ('영등포구', 1), ('용산구', 1), ('은평구', 1), ('종로구', 1), ('중구', 1), ('중랑구', 1); +INSERT INTO `popup` (id, title, thumbnail, start_date, end_date, category_id, sido_id, sigungu_id, info_id) VALUES +(1, '팝업 1', 'http://example.com/thumbnail1', '2020-01-01', '2020-01-31', 1, 1, 1, 1), +(2, '팝업 2', 'http://example.com/thumbnail2', '2020-01-01', '2020-01-31', 1, 1, 1, 2), +(3, '팝업 3', 'http://example.com/thumbnail3', '2020-01-01', '2020-01-31', 1, 1, 1, 3), +(4, '팝업 4', 'http://example.com/thumbnail4', '2020-01-01', '2020-01-31', 1, 1, 1, 4), +(5, '팝업 5', 'http://example.com/thumbnail5', '2020-01-01', '2020-01-31', 1, 1, 1, 5), +(6, '팝업 6', 'http://example.com/thumbnail6', '2020-01-01', '2020-01-31', 1, 1, 1, 6), +(7, '팝업 7', 'http://example.com/thumbnail7', '2020-01-01', '2020-01-31', 1, 1, 1, 7), +(8, '팝업 8', 'http://example.com/thumbnail8', '2020-01-01', '2020-01-31', 1, 1, 1, 8), +(9, '팝업 9', 'http://example.com/thumbnail9', '2020-01-01', '2020-01-31', 1, 1, 1, 9), +(10, '팝업 10', 'http://example.com/thumbnail10', '2020-01-01', '2020-01-31', 1, 1, 1, 10), +(11, '팝업 11', 'http://example.com/thumbnail11', '2020-01-01', '2020-01-31', 1, 1, 1, 11), +(12, '팝업 12', 'http://example.com/thumbnail12', '2020-01-01', '2020-01-31', 1, 1, 1, 12), +(13, '팝업 13', 'http://example.com/thumbnail13', '2020-01-01', '2020-01-31', 1, 1, 1, 13), +(14, '팝업 14', 'http://example.com/thumbnail14', '2020-01-01', '2020-01-31', 1, 1, 1, 14), +(15, '팝업 15', 'http://example.com/thumbnail15', '2020-01-01', '2020-01-31', 1, 1, 1, 15), +(16, '팝업 16', 'http://example.com/thumbnail16', '2020-01-01', '2020-01-31', 1, 1, 1, 16), +(17, '팝업 17', 'http://example.com/thumbnail17', '2020-01-01', '2020-01-31', 1, 1, 1, 17), +(18, '팝업 18', 'http://example.com/thumbnail18', '2020-01-01', '2020-01-31', 1, 1, 1, 18), +(19, '팝업 19', 'http://example.com/thumbnail19', '2020-01-01', '2020-01-31', 1, 1, 1, 19), +(20, '팝업 20', 'http://example.com/thumbnail20', '2020-01-01', '2020-01-31', 1, 1, 1, 20); -INSERT INTO popup (id, title, thumbnail, start_date, end_date, category_id, region_id, info_id) VALUES -(1, 'Title 1', 'http://example.com/thumb1.jpg', '2023-10-02', '2023-11-03', 1, 19, 164), -(2, 'Title 2', 'http://example.com/thumb2.jpg', '2023-08-24', '2023-12-17', 2, 6, 39), -(3, 'Title 3', 'http://example.com/thumb3.jpg', '2023-11-12', '2023-11-22', 2, 14, 23), -(4, 'Title 4', 'http://example.com/thumb4.jpg', '2023-10-26', '2023-12-19', 2, 5, 154), -(5, 'Title 5', 'http://example.com/thumb5.jpg', '2023-01-07', '2023-03-01', 1, 9, 26), -(6, 'Title 6', 'http://example.com/thumb6.jpg', '2023-09-04', '2023-11-10', 1, 25, 120), -(7, 'Title 7', 'http://example.com/thumb7.jpg', '2023-06-12', '2023-07-12', 2, 7, 15), -(8, 'Title 8', 'http://example.com/thumb8.jpg', '2023-07-12', '2023-09-25', 1, 14, 102), -(9, 'Title 9', 'http://example.com/thumb9.jpg', '2023-06-02', '2023-06-11', 3, 14, 190), -(10, 'Title 10', 'http://example.com/thumb10.jpg', '2023-04-22', '2023-08-23', 1, 17, 24), -(11, 'Title 11', 'http://example.com/thumb11.jpg', '2023-10-26', '2023-11-20', 2, 24, 168), -(12, 'Title 12', 'http://example.com/thumb12.jpg', '2023-11-15', '2023-12-14', 3, 18, 21), -(13, 'Title 13', 'http://example.com/thumb13.jpg', '2023-06-13', '2023-10-25', 1, 10, 88), -(14, 'Title 14', 'http://example.com/thumb14.jpg', '2023-03-10', '2023-07-04', 2, 20, 31), -(15, 'Title 15', 'http://example.com/thumb15.jpg', '2023-09-14', '2023-09-28', 3, 22, 123), -(16, 'Title 16', 'http://example.com/thumb16.jpg', '2023-12-30', '2023-12-30', 1, 5, 32), -(17, 'Title 17', 'http://example.com/thumb17.jpg', '2023-03-21', '2023-05-30', 4, 2, 26), -(18, 'Title 18', 'http://example.com/thumb18.jpg', '2023-07-13', '2023-09-27', 3, 21, 4), -(19, 'Title 19', 'http://example.com/thumb19.jpg', '2023-10-09', '2023-12-18', 1, 5, 4), -(20, 'Title 20', 'http://example.com/thumb20.jpg', '2023-08-10', '2023-10-25', 4, 2, 3), -(21, 'Title 21', 'http://example.com/thumb21.jpg', '2023-11-09', '2023-12-15', 1, 1, 178), -(22, 'Title 22', 'http://example.com/thumb22.jpg', '2023-04-20', '2023-11-24', 1, 6, 137), -(23, 'Title 23', 'http://example.com/thumb23.jpg', '2023-08-22', '2023-12-10', 2, 7, 74), -(24, 'Title 24', 'http://example.com/thumb24.jpg', '2023-08-26', '2023-11-22', 2, 16, 16), -(25, 'Title 25', 'http://example.com/thumb25.jpg', '2023-03-23', '2023-07-03', 2, 12, 6), -(26, 'Title 26', 'http://example.com/thumb26.jpg', '2023-09-28', '2023-11-10', 3, 24, 50), -(27, 'Title 27', 'http://example.com/thumb27.jpg', '2023-09-23', '2023-11-20', 1, 16, 77), -(28, 'Title 28', 'http://example.com/thumb28.jpg', '2023-12-26', '2023-12-27', 4, 5, 120), -(29, 'Title 29', 'http://example.com/thumb29.jpg', '2023-11-07', '2023-11-17', 1, 13, 159), -(30, 'Title 30', 'http://example.com/thumb30.jpg', '2023-06-24', '2023-12-08', 3, 24, 195), -(31, 'Title 31', 'http://example.com/thumb31.jpg', '2023-07-15', '2023-08-30', 1, 17, 42), -(32, 'Title 32', 'http://example.com/thumb32.jpg', '2023-09-23', '2023-11-11', 4, 4, 9), -(33, 'Title 33', 'http://example.com/thumb33.jpg', '2023-12-15', '2023-12-27', 2, 9, 184), -(34, 'Title 34', 'http://example.com/thumb34.jpg', '2023-01-09', '2023-11-21', 1, 2, 169), -(35, 'Title 35', 'http://example.com/thumb35.jpg', '2023-11-06', '2023-12-11', 1, 25, 163), -(36, 'Title 36', 'http://example.com/thumb36.jpg', '2023-11-22', '2023-12-19', 3, 6, 73), -(37, 'Title 37', 'http://example.com/thumb37.jpg', '2023-08-24', '2023-11-05', 1, 6, 31), -(38, 'Title 38', 'http://example.com/thumb38.jpg', '2023-01-14', '2023-01-27', 2, 25, 170), -(39, 'Title 39', 'http://example.com/thumb39.jpg', '2023-01-23', '2023-02-20', 1, 23, 116), -(40, 'Title 40', 'http://example.com/thumb40.jpg', '2023-05-07', '2023-11-02', 4, 2, 129), -(41, 'Title 41', 'http://example.com/thumb41.jpg', '2023-06-30', '2023-12-15', 3, 13, 98), -(42, 'Title 42', 'http://example.com/thumb42.jpg', '2023-05-14', '2023-06-05', 2, 24, 101), -(43, 'Title 43', 'http://example.com/thumb43.jpg', '2023-12-19', '2023-12-21', 1, 2, 150), -(44, 'Title 44', 'http://example.com/thumb44.jpg', '2023-03-24', '2023-04-24', 1, 6, 123), -(45, 'Title 45', 'http://example.com/thumb45.jpg', '2023-12-30', '2023-12-30', 2, 24, 173), -(46, 'Title 46', 'http://example.com/thumb46.jpg', '2023-01-19', '2023-12-02', 4, 7, 147), -(47, 'Title 47', 'http://example.com/thumb47.jpg', '2023-02-15', '2023-06-29', 3, 11, 101), -(48, 'Title 48', 'http://example.com/thumb48.jpg', '2023-10-15', '2023-12-24', 3, 9, 175), -(49, 'Title 49', 'http://example.com/thumb49.jpg', '2023-01-11', '2023-12-12', 1, 25, 50), -(50, 'Title 50', 'http://example.com/thumb50.jpg', '2023-09-10', '2023-09-11', 3, 16, 163), -(51, 'Title 51', 'http://example.com/thumb51.jpg', '2023-07-12', '2023-12-23', 4, 17, 35), -(52, 'Title 52', 'http://example.com/thumb52.jpg', '2023-02-12', '2023-06-30', 4, 25, 178), -(53, 'Title 53', 'http://example.com/thumb53.jpg', '2023-03-25', '2023-07-24', 1, 8, 171), -(54, 'Title 54', 'http://example.com/thumb54.jpg', '2023-04-03', '2023-07-31', 4, 18, 129), -(55, 'Title 55', 'http://example.com/thumb55.jpg', '2023-10-24', '2023-12-24', 4, 25, 198), -(56, 'Title 56', 'http://example.com/thumb56.jpg', '2023-11-25', '2023-12-02', 3, 23, 123), -(57, 'Title 57', 'http://example.com/thumb57.jpg', '2023-12-01', '2023-12-31', 4, 1, 125), -(58, 'Title 58', 'http://example.com/thumb58.jpg', '2023-07-25', '2023-12-06', 4, 2, 26), -(59, 'Title 59', 'http://example.com/thumb59.jpg', '2023-09-23', '2023-11-16', 4, 17, 182), -(60, 'Title 60', 'http://example.com/thumb60.jpg', '2023-11-14', '2023-12-23', 1, 18, 115), -(61, 'Title 61', 'http://example.com/thumb61.jpg', '2023-09-19', '2023-11-02', 3, 13, 124), -(62, 'Title 62', 'http://example.com/thumb62.jpg', '2023-08-24', '2023-09-03', 1, 4, 150), -(63, 'Title 63', 'http://example.com/thumb63.jpg', '2023-06-28', '2023-12-09', 3, 19, 162), -(64, 'Title 64', 'http://example.com/thumb64.jpg', '2023-07-20', '2023-10-06', 1, 20, 31), -(65, 'Title 65', 'http://example.com/thumb65.jpg', '2023-10-16', '2023-12-06', 2, 21, 110), -(66, 'Title 66', 'http://example.com/thumb66.jpg', '2023-10-31', '2023-11-18', 2, 4, 97), -(67, 'Title 67', 'http://example.com/thumb67.jpg', '2023-02-03', '2023-10-28', 1, 17, 162), -(68, 'Title 68', 'http://example.com/thumb68.jpg', '2023-04-07', '2023-04-12', 4, 14, 187), -(69, 'Title 69', 'http://example.com/thumb69.jpg', '2023-12-18', '2023-12-19', 2, 22, 39), -(70, 'Title 70', 'http://example.com/thumb70.jpg', '2023-11-28', '2023-11-29', 3, 13, 56), -(71, 'Title 71', 'http://example.com/thumb71.jpg', '2023-07-21', '2023-12-04', 3, 3, 178), -(72, 'Title 72', 'http://example.com/thumb72.jpg', '2023-07-21', '2023-08-24', 3, 1, 120), -(73, 'Title 73', 'http://example.com/thumb73.jpg', '2023-10-14', '2023-10-21', 1, 19, 114), -(74, 'Title 74', 'http://example.com/thumb74.jpg', '2023-11-15', '2023-12-01', 4, 11, 46), -(75, 'Title 75', 'http://example.com/thumb75.jpg', '2023-10-23', '2023-11-10', 4, 8, 120), -(76, 'Title 76', 'http://example.com/thumb76.jpg', '2023-08-26', '2023-10-28', 2, 24, 31), -(77, 'Title 77', 'http://example.com/thumb77.jpg', '2023-07-20', '2023-09-12', 1, 24, 173), -(78, 'Title 78', 'http://example.com/thumb78.jpg', '2023-08-29', '2023-08-31', 4, 23, 69), -(79, 'Title 79', 'http://example.com/thumb79.jpg', '2023-06-28', '2023-11-11', 3, 19, 70), -(80, 'Title 80', 'http://example.com/thumb80.jpg', '2023-03-25', '2023-07-04', 4, 1, 43), -(81, 'Title 81', 'http://example.com/thumb81.jpg', '2023-01-13', '2023-12-14', 2, 20, 200), -(82, 'Title 82', 'http://example.com/thumb82.jpg', '2023-09-04', '2023-12-05', 3, 10, 3), -(83, 'Title 83', 'http://example.com/thumb83.jpg', '2023-01-21', '2023-05-14', 4, 14, 87), -(84, 'Title 84', 'http://example.com/thumb84.jpg', '2023-01-04', '2023-06-09', 1, 12, 23), -(85, 'Title 85', 'http://example.com/thumb85.jpg', '2023-01-23', '2023-02-10', 4, 4, 100), -(86, 'Title 86', 'http://example.com/thumb86.jpg', '2023-02-03', '2023-04-22', 3, 2, 156), -(87, 'Title 87', 'http://example.com/thumb87.jpg', '2023-06-19', '2023-10-03', 1, 8, 139), -(88, 'Title 88', 'http://example.com/thumb88.jpg', '2023-04-28', '2023-05-08', 1, 2, 188), -(89, 'Title 89', 'http://example.com/thumb89.jpg', '2023-02-25', '2023-07-30', 1, 25, 77), -(90, 'Title 90', 'http://example.com/thumb90.jpg', '2023-03-25', '2023-11-16', 2, 12, 165), -(91, 'Title 91', 'http://example.com/thumb91.jpg', '2023-12-07', '2023-12-12', 2, 16, 117), -(92, 'Title 92', 'http://example.com/thumb92.jpg', '2023-01-31', '2023-11-23', 1, 19, 79), -(93, 'Title 93', 'http://example.com/thumb93.jpg', '2023-07-31', '2023-11-28', 1, 21, 2), -(94, 'Title 94', 'http://example.com/thumb94.jpg', '2023-08-16', '2023-12-30', 4, 19, 48), -(95, 'Title 95', 'http://example.com/thumb95.jpg', '2023-05-16', '2023-06-29', 2, 6, 35), -(96, 'Title 96', 'http://example.com/thumb96.jpg', '2023-04-11', '2023-11-10', 3, 2, 114), -(97, 'Title 97', 'http://example.com/thumb97.jpg', '2023-01-08', '2023-12-13', 1, 10, 57), -(98, 'Title 98', 'http://example.com/thumb98.jpg', '2023-06-18', '2023-11-28', 3, 19, 177), -(99, 'Title 99', 'http://example.com/thumb99.jpg', '2023-11-28', '2023-12-16', 3, 1, 21), -(100, 'Title 100', 'http://example.com/thumb100.jpg', '2023-07-02', '2023-11-10', 4, 22, 43), -(101, 'Title 101', 'http://example.com/thumb101.jpg', '2023-11-12', '2023-11-12', 1, 25, 158), -(102, 'Title 102', 'http://example.com/thumb102.jpg', '2023-05-05', '2023-12-07', 1, 25, 82), -(103, 'Title 103', 'http://example.com/thumb103.jpg', '2023-05-30', '2023-09-07', 3, 4, 179), -(104, 'Title 104', 'http://example.com/thumb104.jpg', '2023-02-14', '2023-02-20', 1, 3, 3), -(105, 'Title 105', 'http://example.com/thumb105.jpg', '2023-09-27', '2023-11-28', 3, 5, 39), -(106, 'Title 106', 'http://example.com/thumb106.jpg', '2023-02-17', '2023-02-27', 1, 8, 6), -(107, 'Title 107', 'http://example.com/thumb107.jpg', '2023-03-24', '2023-11-30', 1, 16, 89), -(108, 'Title 108', 'http://example.com/thumb108.jpg', '2023-11-19', '2023-12-24', 1, 14, 85), -(109, 'Title 109', 'http://example.com/thumb109.jpg', '2023-01-23', '2023-01-26', 3, 6, 100), -(110, 'Title 110', 'http://example.com/thumb110.jpg', '2023-04-13', '2023-12-15', 3, 3, 120), -(111, 'Title 111', 'http://example.com/thumb111.jpg', '2023-04-28', '2023-09-18', 4, 22, 50), -(112, 'Title 112', 'http://example.com/thumb112.jpg', '2023-06-14', '2023-10-23', 3, 22, 179), -(113, 'Title 113', 'http://example.com/thumb113.jpg', '2023-07-03', '2023-09-30', 1, 7, 116), -(114, 'Title 114', 'http://example.com/thumb114.jpg', '2023-05-22', '2023-07-28', 2, 8, 46), -(115, 'Title 115', 'http://example.com/thumb115.jpg', '2023-11-30', '2023-12-11', 2, 5, 142), -(116, 'Title 116', 'http://example.com/thumb116.jpg', '2023-02-04', '2023-11-22', 4, 5, 123), -(117, 'Title 117', 'http://example.com/thumb117.jpg', '2023-06-08', '2023-09-21', 1, 25, 15), -(118, 'Title 118', 'http://example.com/thumb118.jpg', '2023-03-02', '2023-05-04', 1, 3, 5), -(119, 'Title 119', 'http://example.com/thumb119.jpg', '2023-12-23', '2023-12-26', 1, 15, 67), -(120, 'Title 120', 'http://example.com/thumb120.jpg', '2023-10-03', '2023-12-25', 4, 2, 126), -(121, 'Title 121', 'http://example.com/thumb121.jpg', '2023-10-27', '2023-12-16', 3, 2, 11), -(122, 'Title 122', 'http://example.com/thumb122.jpg', '2023-04-05', '2023-09-09', 3, 5, 138), -(123, 'Title 123', 'http://example.com/thumb123.jpg', '2023-08-17', '2023-12-08', 4, 10, 184), -(124, 'Title 124', 'http://example.com/thumb124.jpg', '2023-02-22', '2023-12-15', 1, 5, 86), -(125, 'Title 125', 'http://example.com/thumb125.jpg', '2023-06-23', '2023-09-03', 3, 23, 11), -(126, 'Title 126', 'http://example.com/thumb126.jpg', '2023-08-05', '2023-08-26', 1, 20, 132), -(127, 'Title 127', 'http://example.com/thumb127.jpg', '2023-08-18', '2023-12-24', 4, 12, 184), -(128, 'Title 128', 'http://example.com/thumb128.jpg', '2023-07-13', '2023-09-07', 3, 14, 173), -(129, 'Title 129', 'http://example.com/thumb129.jpg', '2023-08-18', '2023-12-19', 4, 23, 50), -(130, 'Title 130', 'http://example.com/thumb130.jpg', '2023-07-15', '2023-12-28', 2, 5, 14), -(131, 'Title 131', 'http://example.com/thumb131.jpg', '2023-10-29', '2023-11-30', 3, 4, 136), -(132, 'Title 132', 'http://example.com/thumb132.jpg', '2023-09-29', '2023-12-29', 3, 19, 89), -(133, 'Title 133', 'http://example.com/thumb133.jpg', '2023-11-01', '2023-11-10', 2, 18, 160), -(134, 'Title 134', 'http://example.com/thumb134.jpg', '2023-06-17', '2023-12-14', 1, 17, 11), -(135, 'Title 135', 'http://example.com/thumb135.jpg', '2023-12-09', '2023-12-10', 2, 18, 127), -(136, 'Title 136', 'http://example.com/thumb136.jpg', '2023-12-13', '2023-12-23', 4, 2, 176), -(137, 'Title 137', 'http://example.com/thumb137.jpg', '2023-06-22', '2023-11-08', 1, 23, 76), -(138, 'Title 138', 'http://example.com/thumb138.jpg', '2023-09-14', '2023-12-26', 1, 7, 120), -(139, 'Title 139', 'http://example.com/thumb139.jpg', '2023-06-13', '2023-07-12', 4, 16, 139), -(140, 'Title 140', 'http://example.com/thumb140.jpg', '2023-03-06', '2023-12-29', 2, 10, 126), -(141, 'Title 141', 'http://example.com/thumb141.jpg', '2023-11-17', '2023-12-26', 3, 8, 67), -(142, 'Title 142', 'http://example.com/thumb142.jpg', '2023-08-19', '2023-10-03', 2, 13, 105), -(143, 'Title 143', 'http://example.com/thumb143.jpg', '2023-04-08', '2023-09-10', 2, 12, 177), -(144, 'Title 144', 'http://example.com/thumb144.jpg', '2023-10-26', '2023-10-28', 4, 25, 157), -(145, 'Title 145', 'http://example.com/thumb145.jpg', '2023-11-04', '2023-11-19', 2, 6, 153), -(146, 'Title 146', 'http://example.com/thumb146.jpg', '2023-03-04', '2023-11-04', 4, 12, 70), -(147, 'Title 147', 'http://example.com/thumb147.jpg', '2023-10-14', '2023-10-15', 4, 2, 185), -(148, 'Title 148', 'http://example.com/thumb148.jpg', '2023-05-23', '2023-12-29', 4, 8, 74), -(149, 'Title 149', 'http://example.com/thumb149.jpg', '2023-09-01', '2023-11-05', 1, 14, 17), -(150, 'Title 150', 'http://example.com/thumb150.jpg', '2023-12-13', '2023-12-16', 2, 23, 37), -(151, 'Title 151', 'http://example.com/thumb151.jpg', '2023-10-26', '2023-11-26', 1, 21, 163), -(152, 'Title 152', 'http://example.com/thumb152.jpg', '2023-07-19', '2023-09-19', 1, 6, 35), -(153, 'Title 153', 'http://example.com/thumb153.jpg', '2023-03-12', '2023-07-15', 2, 15, 169), -(154, 'Title 154', 'http://example.com/thumb154.jpg', '2023-08-08', '2023-12-15', 1, 6, 98), -(155, 'Title 155', 'http://example.com/thumb155.jpg', '2023-01-04', '2023-03-12', 3, 8, 196), -(156, 'Title 156', 'http://example.com/thumb156.jpg', '2023-09-10', '2023-09-26', 2, 24, 194), -(157, 'Title 157', 'http://example.com/thumb157.jpg', '2023-08-25', '2023-11-07', 4, 25, 69), -(158, 'Title 158', 'http://example.com/thumb158.jpg', '2023-12-08', '2023-12-12', 4, 23, 153), -(159, 'Title 159', 'http://example.com/thumb159.jpg', '2023-12-28', '2023-12-28', 2, 17, 16), -(160, 'Title 160', 'http://example.com/thumb160.jpg', '2023-02-13', '2023-04-07', 1, 6, 15), -(161, 'Title 161', 'http://example.com/thumb161.jpg', '2023-01-22', '2023-04-12', 3, 9, 23), -(162, 'Title 162', 'http://example.com/thumb162.jpg', '2023-08-26', '2023-12-19', 4, 13, 116), -(163, 'Title 163', 'http://example.com/thumb163.jpg', '2023-11-05', '2023-12-01', 2, 13, 111), -(164, 'Title 164', 'http://example.com/thumb164.jpg', '2023-08-01', '2023-09-22', 2, 3, 56), -(165, 'Title 165', 'http://example.com/thumb165.jpg', '2023-01-28', '2023-02-01', 3, 18, 79), -(166, 'Title 166', 'http://example.com/thumb166.jpg', '2023-01-30', '2023-02-19', 1, 19, 135), -(167, 'Title 167', 'http://example.com/thumb167.jpg', '2023-07-22', '2023-09-13', 4, 16, 103), -(168, 'Title 168', 'http://example.com/thumb168.jpg', '2023-03-03', '2023-10-20', 1, 5, 180), -(169, 'Title 169', 'http://example.com/thumb169.jpg', '2023-12-24', '2023-12-31', 3, 14, 6), -(170, 'Title 170', 'http://example.com/thumb170.jpg', '2023-04-14', '2023-06-07', 1, 5, 52), -(171, 'Title 171', 'http://example.com/thumb171.jpg', '2023-10-18', '2023-12-25', 1, 9, 40), -(172, 'Title 172', 'http://example.com/thumb172.jpg', '2023-08-29', '2023-09-06', 4, 10, 94), -(173, 'Title 173', 'http://example.com/thumb173.jpg', '2023-09-22', '2023-12-19', 4, 22, 34), -(174, 'Title 174', 'http://example.com/thumb174.jpg', '2023-10-19', '2023-12-07', 2, 15, 178), -(175, 'Title 175', 'http://example.com/thumb175.jpg', '2023-01-11', '2023-05-10', 1, 20, 145), -(176, 'Title 176', 'http://example.com/thumb176.jpg', '2023-11-27', '2023-12-29', 2, 3, 44), -(177, 'Title 177', 'http://example.com/thumb177.jpg', '2023-03-31', '2023-07-08', 4, 21, 151), -(178, 'Title 178', 'http://example.com/thumb178.jpg', '2023-05-17', '2023-12-15', 4, 8, 35), -(179, 'Title 179', 'http://example.com/thumb179.jpg', '2023-01-30', '2023-07-17', 3, 7, 161), -(180, 'Title 180', 'http://example.com/thumb180.jpg', '2023-12-04', '2023-12-13', 3, 3, 142), -(181, 'Title 181', 'http://example.com/thumb181.jpg', '2023-12-05', '2023-12-17', 3, 12, 20), -(182, 'Title 182', 'http://example.com/thumb182.jpg', '2023-06-05', '2023-09-11', 3, 3, 56), -(183, 'Title 183', 'http://example.com/thumb183.jpg', '2023-01-02', '2023-02-25', 1, 20, 124), -(184, 'Title 184', 'http://example.com/thumb184.jpg', '2023-07-25', '2023-08-11', 3, 7, 83), -(185, 'Title 185', 'http://example.com/thumb185.jpg', '2023-04-17', '2023-12-26', 2, 10, 43), -(186, 'Title 186', 'http://example.com/thumb186.jpg', '2023-01-26', '2023-10-03', 1, 6, 151), -(187, 'Title 187', 'http://example.com/thumb187.jpg', '2023-08-22', '2023-12-15', 3, 4, 55), -(188, 'Title 188', 'http://example.com/thumb188.jpg', '2023-06-02', '2023-07-06', 3, 15, 136), -(189, 'Title 189', 'http://example.com/thumb189.jpg', '2023-06-23', '2023-12-20', 4, 23, 95), -(190, 'Title 190', 'http://example.com/thumb190.jpg', '2023-05-06', '2023-09-01', 1, 4, 162), -(191, 'Title 191', 'http://example.com/thumb191.jpg', '2023-07-12', '2023-09-12', 3, 14, 119), -(192, 'Title 192', 'http://example.com/thumb192.jpg', '2023-01-02', '2023-03-10', 2, 7, 103), -(193, 'Title 193', 'http://example.com/thumb193.jpg', '2023-04-10', '2023-06-09', 1, 16, 23), -(194, 'Title 194', 'http://example.com/thumb194.jpg', '2023-10-30', '2023-12-02', 3, 7, 161), -(195, 'Title 195', 'http://example.com/thumb195.jpg', '2023-12-25', '2023-12-31', 2, 19, 147), -(196, 'Title 196', 'http://example.com/thumb196.jpg', '2023-04-19', '2023-05-13', 4, 25, 58), -(197, 'Title 197', 'http://example.com/thumb197.jpg', '2023-03-07', '2023-09-14', 3, 18, 71), -(198, 'Title 198', 'http://example.com/thumb198.jpg', '2023-08-27', '2023-12-04', 4, 10, 117), -(199, 'Title 199', 'http://example.com/thumb199.jpg', '2023-07-27', '2023-09-17', 4, 22, 138), -(200, 'Title 200', 'http://example.com/thumb200.jpg', '2023-09-30', '2023-11-21', 2, 17, 51); +INSERT INTO `popup_info` (id, url_link, introduction, address, lat, lng, start_time, end_time, create_date, update_date) VALUES +(1, 'http://example.com/url_link1', '소개1', '주소1', '위도1', '경도1', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(2, 'http://example.com/url_link2', '소개2', '주소2', '위도2', '경도2', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(3, 'http://example.com/url_link3', '소개3', '주소3', '위도3', '경도3', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(4, 'http://example.com/url_link4', '소개4', '주소4', '위도4', '경도4', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(5, 'http://example.com/url_link5', '소개5', '주소5', '위도5', '경도5', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(6, 'http://example.com/url_link6', '소개6', '주소6', '위도6', '경도6', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(7, 'http://example.com/url_link7', '소개7', '주소7', '위도7', '경도7', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(8, 'http://example.com/url_link8', '소개8', '주소8', '위도8', '경도8', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(9, 'http://example.com/url_link9', '소개9', '주소9', '위도9', '경도9', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(10, 'http://example.com/url_link10', '소개10', '주소10', '위도10', '경도10', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(11, 'http://example.com/url_link11', '소개11', '주소11', '위도11', '경도11', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(12, 'http://example.com/url_link12', '소개12', '주소12', '위도12', '경도12', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(13, 'http://example.com/url_link13', '소개13', '주소13', '위도13', '경도13', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(14, 'http://example.com/url_link14', '소개14', '주소14', '위도14', '경도14', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(15, 'http://example.com/url_link15', '소개15', '주소15', '위도15', '경도15', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(16, 'http://example.com/url_link16', '소개16', '주소16', '위도16', '경도16', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(17, 'http://example.com/url_link17', '소개17', '주소17', '위도17', '경도17', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(18, 'http://example.com/url_link18', '소개18', '주소18', '위도18', '경도18', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(19, 'http://example.com/url_link19', '소개19', '주소19', '위도19', '경도19', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'), +(20, 'http://example.com/url_link20', '소개20', '주소20', '위도20', '경도20', '09:00:00', '18:00:00', '2020-01-01 00:00:00', '2020-01-01 00:00:00'); INSERT INTO `image` (popup_id, url) VALUES (1, 'http://example.com/image1.jpg'), diff --git a/src/main/java/com/todaypopup/todaypopup/core/model/PopupEntity.java b/src/main/java/com/todaypopup/todaypopup/core/model/PopupEntity.java index 47e4b8b..e4587d8 100644 --- a/src/main/java/com/todaypopup/todaypopup/core/model/PopupEntity.java +++ b/src/main/java/com/todaypopup/todaypopup/core/model/PopupEntity.java @@ -46,8 +46,12 @@ public class PopupEntity extends BaseTimeEntity { private CategoryEntity category; @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "region_id", referencedColumnName = "id", insertable = false, updatable = false) - private RegionEntity region; + @JoinColumn(name = "sido_id", referencedColumnName = "id", insertable = false, updatable = false) + private SidoEntity sido; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "sigungu_id", referencedColumnName = "id", insertable = false, updatable = false) + private SigunguEntity sigungu; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "info_id", referencedColumnName = "id") diff --git a/src/main/java/com/todaypopup/todaypopup/core/model/PopupInfoEntity.java b/src/main/java/com/todaypopup/todaypopup/core/model/PopupInfoEntity.java index 1d814d0..1988e0a 100644 --- a/src/main/java/com/todaypopup/todaypopup/core/model/PopupInfoEntity.java +++ b/src/main/java/com/todaypopup/todaypopup/core/model/PopupInfoEntity.java @@ -29,6 +29,12 @@ public class PopupInfoEntity extends BaseTimeEntity { @Column(name = "address") private String address; + @Column(name = "lat") + private String lat; + + @Column(name = "lng") + private String lng; + @Column(name = "start_time") private Date startTime; diff --git a/src/main/java/com/todaypopup/todaypopup/core/model/RegionEntity.java b/src/main/java/com/todaypopup/todaypopup/core/model/SidoEntity.java similarity index 57% rename from src/main/java/com/todaypopup/todaypopup/core/model/RegionEntity.java rename to src/main/java/com/todaypopup/todaypopup/core/model/SidoEntity.java index fe517a8..7e66c8e 100644 --- a/src/main/java/com/todaypopup/todaypopup/core/model/RegionEntity.java +++ b/src/main/java/com/todaypopup/todaypopup/core/model/SidoEntity.java @@ -5,23 +5,25 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; +import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) -@Entity(name = "region") -@Table(name = "region") -public class RegionEntity extends BaseTimeEntity { +@Entity(name = "sido") +@Table(name = "sido") +public class SidoEntity extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; + private Long id; - @Column(name = "sido", nullable = false) - private String sido; + @Column(name = "name", nullable = false) + private String name; - @Column(name = "sigungu", nullable = false) - private String sigungu; + @OneToMany(mappedBy = "sido") + private List sigungus; } diff --git a/src/main/java/com/todaypopup/todaypopup/core/model/SigunguEntity.java b/src/main/java/com/todaypopup/todaypopup/core/model/SigunguEntity.java new file mode 100644 index 0000000..d20b30e --- /dev/null +++ b/src/main/java/com/todaypopup/todaypopup/core/model/SigunguEntity.java @@ -0,0 +1,31 @@ +package com.todaypopup.todaypopup.core.model; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +@Entity(name = "sigungu") +@Table(name = "sigungu") +public class SigunguEntity extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "name", nullable = false) + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "sido_id", referencedColumnName = "id") + private SidoEntity sido; +} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupDetailResponseDto.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupDetailResponseDto.java index 63f80d5..da53be9 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupDetailResponseDto.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupDetailResponseDto.java @@ -17,6 +17,8 @@ public class GetPopupDetailResponseDto { private String endTime; private String urlLink; private String introduction; - private String address; + private String sido; + private String sigungu; + private LocationDto location; } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsRequestDto.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsRequestDto.java index 2979b13..cf2097e 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsRequestDto.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsRequestDto.java @@ -11,6 +11,7 @@ public class GetPopupsRequestDto extends PaginationQueryDto { private Integer category; - private Integer region; + private Integer sidoId; + private Integer sigunguId; } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsResponseDto.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsResponseDto.java index 18074c4..7d3a70e 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsResponseDto.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/GetPopupsResponseDto.java @@ -7,7 +7,7 @@ @Data @Builder public class GetPopupsResponseDto { - + private Long id; private String thumbnail; private String title; private String startDate; diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/LocationDto.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/LocationDto.java new file mode 100644 index 0000000..4475dd9 --- /dev/null +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/dto/LocationDto.java @@ -0,0 +1,14 @@ +package com.todaypopup.todaypopup.domain.popup.dto; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class LocationDto { + + private String address; + private String lat; + private String lng; + +} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/repository/PopupRepositoryImpl.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/repository/PopupRepositoryImpl.java index a85eed3..2cb3d4c 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/popup/repository/PopupRepositoryImpl.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/repository/PopupRepositoryImpl.java @@ -33,8 +33,11 @@ public List getPopups(GetPopupsRequestDto queryDto) throws Exceptio if (queryDto.getCategory() != null) { predicates.add(cb.equal(popup.get("category").get("id"), queryDto.getCategory())); } - if (queryDto.getRegion() != null) { - predicates.add(cb.equal(popup.get("region").get("id"), queryDto.getRegion())); + if (queryDto.getSidoId() != null) { + predicates.add(cb.equal(popup.get("sido").get("id"), queryDto.getSidoId())); + } + if (queryDto.getSigunguId() != null) { + predicates.add(cb.equal(popup.get("sigungu").get("id"), queryDto.getSigunguId())); } // Cursor diff --git a/src/main/java/com/todaypopup/todaypopup/domain/popup/service/PopupServiceImpl.java b/src/main/java/com/todaypopup/todaypopup/domain/popup/service/PopupServiceImpl.java index 9f3032a..826c875 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/popup/service/PopupServiceImpl.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/popup/service/PopupServiceImpl.java @@ -9,6 +9,7 @@ import com.todaypopup.todaypopup.domain.popup.dto.GetPopupDetailResponseDto; import com.todaypopup.todaypopup.domain.popup.dto.GetPopupsRequestDto; import com.todaypopup.todaypopup.domain.popup.dto.GetPopupsResponseDto; +import com.todaypopup.todaypopup.domain.popup.dto.LocationDto; import com.todaypopup.todaypopup.domain.popup.repository.ImageRepository; import com.todaypopup.todaypopup.domain.popup.repository.PopupRepository; import com.todaypopup.todaypopup.domain.popup.repository.PopupRepositoryCustom; @@ -65,7 +66,7 @@ public PaginationResponseDto getPopups(GetPopupsRequestDto public GetPopupDetailResponseDto getPopupDetail(Long popupId) throws Exception { Optional popupOptional = popupRepository.findById(popupId); - if (!popupOptional.isPresent()) { + if (popupOptional.isEmpty()) { throw new IllegalArgumentException("Invalid popupId"); } @@ -75,6 +76,12 @@ public GetPopupDetailResponseDto getPopupDetail(Long popupId) throws Exception { .map(ImageEntity::getUrl) .collect(Collectors.toList()); + LocationDto location = LocationDto.builder() + .address(popup.getPopupInfo().getAddress()) + .lat(popup.getPopupInfo().getLat()) + .lng(popup.getPopupInfo().getLng()) + .build(); + return GetPopupDetailResponseDto.builder() .images(imageUrls) .category(popup.getCategory().getName()) @@ -85,7 +92,9 @@ public GetPopupDetailResponseDto getPopupDetail(Long popupId) throws Exception { .endTime(DateUtil.parseDateToTimeOnly(popup.getPopupInfo().getEndTime())) .urlLink(popup.getPopupInfo().getUrlLink()) .introduction(popup.getPopupInfo().getIntroduction()) - .address(popup.getPopupInfo().getAddress()) + .sido(popup.getSido().getName()) + .sigungu(popup.getSigungu().getName()) + .location(location) .build(); } @@ -117,12 +126,13 @@ private String getNextCursorValue(List popups, GetPopupsRequestDto public List convertToDtoList(List popupEntities) { return popupEntities.stream().map(popup -> GetPopupsResponseDto.builder() + .id(popup.getId()) .thumbnail(popup.getThumbnail()) .title(popup.getTitle()) .startDate(DateUtil.parseDateToDateOnly(popup.getStartDate())) .endDate(DateUtil.parseDateToDateOnly(popup.getEndDate())) - .sido(popup.getRegion().getSido()) - .sigungu(popup.getRegion().getSigungu()) + .sido(popup.getSido().getName()) + .sigungu(popup.getSigungu().getName()) .category(popup.getCategory().getName()) .build()).collect(Collectors.toList()); } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/controller/RegionController.java b/src/main/java/com/todaypopup/todaypopup/domain/region/controller/RegionController.java index 7ec8240..bcddee7 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/controller/RegionController.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/controller/RegionController.java @@ -3,6 +3,7 @@ import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoRequestDto; import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoResponseDto; import com.todaypopup.todaypopup.domain.region.service.RegionService; +import java.util.List; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; @@ -18,10 +19,10 @@ public RegionController(RegionService regionService) { } @GetMapping("/v1/region") - public ResponseEntity getRegionInfo( + public ResponseEntity> getRegionInfo( @ModelAttribute GetRegionInfoRequestDto queryDto) throws Exception { - GetRegionInfoResponseDto response = this.regionService.getRegionInfo(queryDto); + List response = this.regionService.getRegionInfo(queryDto); return ResponseEntity.ok().body(response); } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoRequestDto.java b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoRequestDto.java index 98048c9..e23f540 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoRequestDto.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoRequestDto.java @@ -9,5 +9,5 @@ @NoArgsConstructor public class GetRegionInfoRequestDto { - private Long regionId; + private Long sidoId; } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoResponseDto.java b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoResponseDto.java index 3b0c8cd..701bd25 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoResponseDto.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/GetRegionInfoResponseDto.java @@ -1,9 +1,7 @@ package com.todaypopup.todaypopup.domain.region.dto; import com.fasterxml.jackson.annotation.JsonInclude; -import com.todaypopup.todaypopup.core.model.RegionEntity; import java.util.List; -import java.util.Optional; import lombok.Builder; import lombok.Data; @@ -12,6 +10,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public class GetRegionInfoResponseDto { - private List regionList; - private Optional region; + private Long sidoId; + private String sidoName; + private List sigunguList; } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/dto/SigunguDto.java b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/SigunguDto.java new file mode 100644 index 0000000..8f4c90b --- /dev/null +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/dto/SigunguDto.java @@ -0,0 +1,14 @@ +package com.todaypopup.todaypopup.domain.region.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SigunguDto { + + private Long sigunguId; + private String sigunguName; +} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/repository/RegionRepository.java b/src/main/java/com/todaypopup/todaypopup/domain/region/repository/RegionRepository.java deleted file mode 100644 index b36a1b2..0000000 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/repository/RegionRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.todaypopup.todaypopup.domain.region.repository; - -import com.todaypopup.todaypopup.core.model.RegionEntity; -import java.util.List; -import java.util.Optional; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface RegionRepository extends JpaRepository { - - @Override - List findAll(); - - @Override - Optional findById(Long regionId); -} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SidoRepository.java b/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SidoRepository.java new file mode 100644 index 0000000..3cc1776 --- /dev/null +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SidoRepository.java @@ -0,0 +1,8 @@ +package com.todaypopup.todaypopup.domain.region.repository; + +import com.todaypopup.todaypopup.core.model.SidoEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface SidoRepository extends JpaRepository { + +} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SigunguRepository.java b/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SigunguRepository.java new file mode 100644 index 0000000..994fbbf --- /dev/null +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/repository/SigunguRepository.java @@ -0,0 +1,10 @@ +package com.todaypopup.todaypopup.domain.region.repository; + +import com.todaypopup.todaypopup.core.model.SigunguEntity; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface SigunguRepository extends JpaRepository { + List findBySidoId(Long sidoId); + +} diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionService.java b/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionService.java index 33380a0..d5e248c 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionService.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionService.java @@ -2,8 +2,9 @@ import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoRequestDto; import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoResponseDto; +import java.util.List; public interface RegionService { - GetRegionInfoResponseDto getRegionInfo(GetRegionInfoRequestDto queryDto) throws Exception; + List getRegionInfo(GetRegionInfoRequestDto queryDto) throws Exception; } diff --git a/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionServiceImpl.java b/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionServiceImpl.java index 2d1025f..8e3a997 100644 --- a/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionServiceImpl.java +++ b/src/main/java/com/todaypopup/todaypopup/domain/region/service/RegionServiceImpl.java @@ -1,29 +1,63 @@ package com.todaypopup.todaypopup.domain.region.service; +import com.todaypopup.todaypopup.core.model.SidoEntity; import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoRequestDto; import com.todaypopup.todaypopup.domain.region.dto.GetRegionInfoResponseDto; -import com.todaypopup.todaypopup.domain.region.repository.RegionRepository; +import com.todaypopup.todaypopup.domain.region.dto.SigunguDto; +import com.todaypopup.todaypopup.domain.region.repository.SidoRepository; +import com.todaypopup.todaypopup.domain.region.repository.SigunguRepository; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import org.springframework.stereotype.Service; @Service public class RegionServiceImpl implements RegionService { - private final RegionRepository regionRepository; + private final SidoRepository sidoRepository; + private final SigunguRepository sigunguRepository; - public RegionServiceImpl(RegionRepository regionRepository) { - this.regionRepository = regionRepository; + public RegionServiceImpl(SidoRepository sidoRepository, SigunguRepository sigunguRepository) { + this.sidoRepository = sidoRepository; + this.sigunguRepository = sigunguRepository; } @Override - public GetRegionInfoResponseDto getRegionInfo(GetRegionInfoRequestDto queryDto) throws Exception { - if (queryDto.getRegionId() == null) { - return GetRegionInfoResponseDto.builder() - .regionList(this.regionRepository.findAll()) - .build(); + public List getRegionInfo(GetRegionInfoRequestDto queryDto) throws Exception { + if (queryDto.getSidoId() == null) { + List sidoList = this.sidoRepository.findAll(); + + if (sidoList.isEmpty()) { + throw new Exception("존재하지 않는 시도입니다."); + } + + return sidoList.stream() + .map(sido -> GetRegionInfoResponseDto.builder() + .sidoId(sido.getId()) + .sidoName(sido.getName()) + .build()) + .toList(); } - return GetRegionInfoResponseDto.builder() - .region(this.regionRepository.findById(queryDto.getRegionId())) + Optional sido = this.sidoRepository.findById(queryDto.getSidoId()); + + if (sido.isEmpty()) { + throw new Exception("존재하지 않는 시도입니다."); + } + + List sigunguList = this.sigunguRepository.findBySidoId(sido.get().getId()).stream() + .map(sigungu -> SigunguDto.builder() + .sigunguId(sigungu.getId()) + .sigunguName(sigungu.getName()) + .build()) + .toList(); + + GetRegionInfoResponseDto responseDto = GetRegionInfoResponseDto.builder() + .sidoId(sido.get().getId()) + .sidoName(sido.get().getName()) + .sigunguList(sigunguList) .build(); + + return Collections.singletonList(responseDto); } } diff --git a/src/main/resources/application-dev.yaml b/src/main/resources/application-dev.yaml new file mode 100644 index 0000000..54ce7af --- /dev/null +++ b/src/main/resources/application-dev.yaml @@ -0,0 +1,25 @@ +server: + port: 8080 + +spring: + config: + activate: + on-profile: dev + + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://$${{ secrets.MYSQL_URL_DEV }}:3306/today_popup?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&useLegacyDatetimeCode=false&serverTimezone=KST + username: ${{ secrets.MYSQL_USERNAME_DEV }} + password: ${{ secrets.MYSQL_PASSWORD_DEV }} + + jpa: + open-in-view: true + show-sql: true + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + properties: + hibernate.format_sql: true + jdbc: + time_zone: KST diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 2e53a58..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://db_mysql:3306/today_popup?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&useLegacyDatetimeCode=false&serverTimezone=KST -spring.datasource.username=root -spring.datasource.password=root diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index dfacec1..730d3ed 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,4 +1,16 @@ +server: + port: 8080 + spring: + profiles: + default: local + + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://db_mysql:3306/today_popup?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&useLegacyDatetimeCode=false&serverTimezone=KST + username: root + password: root + jpa: open-in-view: true show-sql: true