diff --git a/src/main/java/com/example/demo/app/infra/entity/CourseEntity.java b/src/main/java/com/example/demo/app/infra/entity/CourseEntity.java index 3afec50..fc66343 100644 --- a/src/main/java/com/example/demo/app/infra/entity/CourseEntity.java +++ b/src/main/java/com/example/demo/app/infra/entity/CourseEntity.java @@ -8,7 +8,6 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.OneToMany; -import jakarta.persistence.OneToOne; import jakarta.persistence.Table; import com.example.demo.app.domain.model.CourseModel; @@ -39,10 +38,6 @@ public class CourseEntity { @OneToMany(mappedBy = "courseEntity") private List userEntity; - @OneToOne(mappedBy = "courseEntity") - private AllocationEntity allocationEntity; - - public static List createCourseModelList(List courseEntityList) { return courseEntityList diff --git a/src/main/java/com/example/demo/app/presentation/controller/CourseController.java b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java new file mode 100644 index 0000000..ff520ae --- /dev/null +++ b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java @@ -0,0 +1,52 @@ +package com.example.demo.app.presentation.controller; + +import java.util.logging.Logger; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +import com.example.demo.app.domain.service.CourseInfoService; +import com.example.demo.app.domain.service.CourseService; +import com.example.demo.app.presentation.form.CourseForm; +import com.example.demo.app.presentation.form.CourseInfoForm; + +import lombok.RequiredArgsConstructor; + + +@Controller +@RequiredArgsConstructor +public class CourseController { + + private final static Logger LOGGER = Logger.getLogger(CourseController.class.getName()); + // エラーメッセージ用の定数フィールド + private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; + + // private final HttpSession httpSession; + private final CourseService courseService; + private final CourseInfoService courseInfoService; + + + + @GetMapping("/select-course") + public String select(Model model) { + + //try { + model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); + model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + + return "select_course"; + + //} catch (Exception e) { +// // ログイン情報の破棄 +// httpSession.invalidate(); +// +// e.printStackTrace(); +// +// // エラーログ出力 +// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); +// // エラー画面遷移 +// return null; +// } + } +} diff --git a/src/main/resources/templates/select_course.html b/src/main/resources/templates/select_course.html new file mode 100644 index 0000000..bd50a1e --- /dev/null +++ b/src/main/resources/templates/select_course.html @@ -0,0 +1,35 @@ + + + + +コース選択 + + + +
+
+

+ +

+
+
+ + + + 配分(%) + + + + + +
カテゴリ名
+
+
+
+
+ + + + \ No newline at end of file