diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/api/AboutController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/api/AboutController.kt index 183e4a5e..22c92fb8 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/about/api/AboutController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/api/AboutController.kt @@ -1,6 +1,8 @@ package com.wafflestudio.csereal.core.about.api import com.wafflestudio.csereal.core.about.dto.AboutDto +import com.wafflestudio.csereal.core.about.dto.CompanyDto +import com.wafflestudio.csereal.core.about.dto.FutureCareersPage import com.wafflestudio.csereal.core.about.service.AboutService import jakarta.validation.Valid import org.springframework.http.ResponseEntity @@ -50,5 +52,9 @@ class AboutController( fun readAllDirections() : ResponseEntity> { return ResponseEntity.ok(aboutService.readAllDirections()) } + @GetMapping("/future-careers") + fun readFutureCareers(): ResponseEntity { + return ResponseEntity.ok(aboutService.readFutureCareers()) + } } \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyEntity.kt new file mode 100644 index 00000000..e47afbaa --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyEntity.kt @@ -0,0 +1,12 @@ +package com.wafflestudio.csereal.core.about.database + +import com.wafflestudio.csereal.common.config.BaseTimeEntity +import jakarta.persistence.Entity + +@Entity(name = "company") +class CompanyEntity( + var name: String, + var url: String, + var year: Int, +) : BaseTimeEntity() { +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyRepository.kt new file mode 100644 index 00000000..a408c8a8 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/CompanyRepository.kt @@ -0,0 +1,7 @@ +package com.wafflestudio.csereal.core.about.database + +import org.springframework.data.jpa.repository.JpaRepository + +interface CompanyRepository: JpaRepository { + fun findAllByOrderByYearDesc(): List +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatEntity.kt new file mode 100644 index 00000000..db433127 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatEntity.kt @@ -0,0 +1,21 @@ +package com.wafflestudio.csereal.core.about.database + +import com.wafflestudio.csereal.common.config.BaseTimeEntity +import jakarta.persistence.Entity +import jakarta.persistence.EnumType +import jakarta.persistence.Enumerated + +@Entity(name = "stat") +class StatEntity( + var year: Int, + + @Enumerated(EnumType.STRING) + var degree: Degree, + var name: String, + var count: Int, +): BaseTimeEntity() { +} + +enum class Degree { + BACHELOR, MASTER, DOCTOR +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatRepository.kt new file mode 100644 index 00000000..a34d825d --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/database/StatRepository.kt @@ -0,0 +1,7 @@ +package com.wafflestudio.csereal.core.about.database + +import org.springframework.data.jpa.repository.JpaRepository + +interface StatRepository: JpaRepository { + fun findAllByYearAndDegree(year: Int, degree: Degree): List +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyDto.kt new file mode 100644 index 00000000..1cc30403 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyDto.kt @@ -0,0 +1,8 @@ +package com.wafflestudio.csereal.core.about.dto + +data class CompanyDto( + val name: String, + val url: String, + val year: Int, +) { +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyNameAndCountDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyNameAndCountDto.kt new file mode 100644 index 00000000..b449193c --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/CompanyNameAndCountDto.kt @@ -0,0 +1,8 @@ +package com.wafflestudio.csereal.core.about.dto + +data class CompanyNameAndCountDto( + val id: Long, + val name: String, + val count: Int +) { +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/FutureCareersPage.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/FutureCareersPage.kt new file mode 100644 index 00000000..656c26c9 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/FutureCareersPage.kt @@ -0,0 +1,8 @@ +package com.wafflestudio.csereal.core.about.dto + +data class FutureCareersPage( + val description: String, + val stat: List, + val companies: List +) { +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/StatDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/StatDto.kt new file mode 100644 index 00000000..45e53137 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/dto/StatDto.kt @@ -0,0 +1,9 @@ +package com.wafflestudio.csereal.core.about.dto + +data class StatDto( + val year: Int, + val bachelor: List, + val master: List, + val doctor: List +) { +} \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt index f973a5c5..9424d73b 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/about/service/AboutService.kt @@ -1,11 +1,8 @@ package com.wafflestudio.csereal.core.about.service import com.wafflestudio.csereal.common.CserealException -import com.wafflestudio.csereal.core.about.database.AboutEntity -import com.wafflestudio.csereal.core.about.database.AboutPostType -import com.wafflestudio.csereal.core.about.database.AboutRepository -import com.wafflestudio.csereal.core.about.database.LocationEntity -import com.wafflestudio.csereal.core.about.dto.AboutDto +import com.wafflestudio.csereal.core.about.database.* +import com.wafflestudio.csereal.core.about.dto.* import com.wafflestudio.csereal.core.resource.attachment.service.AttachmentService import com.wafflestudio.csereal.core.resource.mainImage.service.MainImageService import org.springframework.stereotype.Service @@ -18,11 +15,15 @@ interface AboutService { fun readAllClubs() : List fun readAllFacilities() : List fun readAllDirections(): List + fun readFutureCareers(): FutureCareersPage + } @Service class AboutServiceImpl( private val aboutRepository: AboutRepository, + private val companyRepository: CompanyRepository, + private val statRepository: StatRepository, private val mainImageService: MainImageService, private val attachmentService: AttachmentService, ) : AboutService { @@ -96,6 +97,61 @@ class AboutServiceImpl( return directions } + @Transactional + override fun readFutureCareers(): FutureCareersPage { + val description = "컴퓨터공학을 전공함으로써 벤처기업을 창업할 수 있을 뿐 " + + "아니라 시스템엔지니어, 보안전문가, 소프트웨어개발자, 데이터베이스관리자 등 " + + "많은 IT 전문 분야로의 진출이 가능하다. 또한 컴퓨터공학은 바이오, 전자전기, " + + "로봇, 기계, 의료 등 이공계 영역뿐만 아니라 정치, 경제, 사회, 문화의 다양한 분야와 " + + "결합되어 미래 지식정보사회에 대한 새로운 가능성을 제시하고 있고 새로운 학문적 과제가 " + + "지속적으로 생산되기 때문에 많은 전문연구인력이 필요하다.\n" + + "\n" + + "서울대학교 컴퓨터공학부의 경우 학부 졸업생 절반 이상이 대학원에 진학하고 있다. " + + "대학원에 진학하면 여러 전공분야 중 하나를 선택하여 보다 깊이 있는 지식의 습득과 연구과정을 거치게 되며 " + + "그 이후로는 국내외 관련 산업계, 학계에 주로 진출하고 있고, 새로운 아이디어로 벤처기업을 창업하기도 한다." + + val statList = mutableListOf() + for(i: Int in 2021 downTo 2011) { + val bachelor = statRepository.findAllByYearAndDegree(i, Degree.BACHELOR).map { + CompanyNameAndCountDto( + id = it.id, + name = it.name, + count = it.count + ) + } + val master = statRepository.findAllByYearAndDegree(i, Degree.MASTER).map { + CompanyNameAndCountDto( + id = it.id, + name = it.name, + count = it.count, + ) + } + val doctor = statRepository.findAllByYearAndDegree(i, Degree.DOCTOR).map { + CompanyNameAndCountDto( + id = it.id, + name = it.name, + count = it.count, + ) + } + statList.add( + StatDto( + year = i, + bachelor = bachelor, + master = master, + doctor = doctor, + ) + ) + } + val companyList = companyRepository.findAllByOrderByYearDesc().map { + CompanyDto( + name = it.name, + url = it.url, + year = it.year + ) + } + return FutureCareersPage(description, statList, companyList) + } + private fun makeStringToEnum(postType: String) : AboutPostType { try { val upperPostType = postType.replace("-","_").uppercase() diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/conference/api/ConferenceController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/conference/api/ConferenceController.kt index 7c78df5d..75a3cde7 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/conference/api/ConferenceController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/conference/api/ConferenceController.kt @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController -@RequestMapping("/conference") +@RequestMapping("/api/v1/conference") @RestController class ConferenceController( private val conferenceService: ConferenceService