-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from HanRiverMeetup/issue-70
#70 카테고리 목록을 불러오는 API 작성
- Loading branch information
Showing
7 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/com/hangang/HangangRiver/meeting/dao/ActivityMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.hangang.HangangRiver.meeting.dao; | ||
|
||
import com.hangang.HangangRiver.meeting.model.Activity; | ||
|
||
import java.util.List; | ||
|
||
public interface ActivityMapper { | ||
List<Activity> getAllActivities(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/hangang/HangangRiver/meeting/model/Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.hangang.HangangRiver.meeting.model; | ||
|
||
public class Activity { | ||
private int activity_seq; | ||
private String name; | ||
private String description; | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public int getActivity_seq() { | ||
return activity_seq; | ||
} | ||
|
||
public void setActivity_seq(int activity_seq) { | ||
this.activity_seq = activity_seq; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/hangang/HangangRiver/meeting/service/ActivityService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.hangang.HangangRiver.meeting.service; | ||
|
||
import com.hangang.HangangRiver.meeting.dao.ActivityMapper; | ||
import com.hangang.HangangRiver.meeting.model.Activity; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
public class ActivityService { | ||
@Autowired | ||
public ActivityMapper activityMapper; | ||
|
||
public List<Activity> getAllActivities() { | ||
return activityMapper.getAllActivities(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/hangang/HangangRiver/meeting/web/ActivityController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.hangang.HangangRiver.meeting.web; | ||
|
||
import com.hangang.HangangRiver.meeting.model.Activity; | ||
import com.hangang.HangangRiver.meeting.service.ActivityService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/activity") | ||
public class ActivityController { | ||
@Autowired | ||
ActivityService activityService; | ||
|
||
@GetMapping("/all") | ||
private ResponseEntity<List<Activity>> getAllActivities() { | ||
return ResponseEntity.ok().body(activityService.getAllActivities()); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/resources/com/hangang/HangangRiver/ActivityMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="com.hangang.HangangRiver.meeting.dao.ActivityMapper"> | ||
<select id="getAllActivities" resultType="com.hangang.HangangRiver.meeting.model.Activity"> | ||
SELECT * | ||
FROM activity | ||
</select> | ||
</mapper> |