From 6b91c91c191825648b889d36d1188e929053de2c Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 17 Sep 2026 14:29:59 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[ADD]=20Course,=20CourseInfoForm=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/presentation/form/CourseForm.java | 33 ++++++++++++++ .../app/presentation/form/CourseInfoForm.java | 44 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/main/java/com/example/demo/app/presentation/form/CourseForm.java create mode 100644 src/main/java/com/example/demo/app/presentation/form/CourseInfoForm.java diff --git a/src/main/java/com/example/demo/app/presentation/form/CourseForm.java b/src/main/java/com/example/demo/app/presentation/form/CourseForm.java new file mode 100644 index 0000000..57ba52e --- /dev/null +++ b/src/main/java/com/example/demo/app/presentation/form/CourseForm.java @@ -0,0 +1,33 @@ +package com.example.demo.app.presentation.form; + +import java.util.List; + +import com.example.demo.app.domain.model.CourseModel; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CourseForm { + + private Long courseId; + private String courseName; + private String description; + + + public static CourseForm convertFrom(CourseModel courseModel) { + return new CourseForm( + courseModel.getCourseId(), + courseModel.getCourseName(), + courseModel.getDescription() + ); + } + + public static List convertFrom(List courseModelList){ + return courseModelList.stream().map(CourseForm::convertFrom).toList(); + } + +} diff --git a/src/main/java/com/example/demo/app/presentation/form/CourseInfoForm.java b/src/main/java/com/example/demo/app/presentation/form/CourseInfoForm.java new file mode 100644 index 0000000..addce2f --- /dev/null +++ b/src/main/java/com/example/demo/app/presentation/form/CourseInfoForm.java @@ -0,0 +1,44 @@ +package com.example.demo.app.presentation.form; + +import java.util.List; + +import com.example.demo.app.domain.model.CourseInfoModel; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CourseInfoForm { + + private Long courseId; + + private String courseName; + + private Long categoryId; + + private String categoryName; + + private Integer allocationRatio; + + + public static CourseInfoForm convertFrom(CourseInfoModel courseInfoModel ) { + return new CourseInfoForm(courseInfoModel.getCategoryId(), courseInfoModel.getCourseName(), courseInfoModel.getCategoryId(), courseInfoModel.getCategoryName(), courseInfoModel.getAllocationRatio()); + } + + public static List convertFrom(List courseInfoModelList ) { + return courseInfoModelList.stream().map(CourseInfoForm::convertFrom).toList(); + } + + public static CourseInfoModel convertTo(CourseInfoForm courseInfoForm) { + return new CourseInfoModel( + courseInfoForm.getCourseId(), + courseInfoForm.getCourseName(), + courseInfoForm.getCategoryId(), + courseInfoForm.getCategoryName(), + courseInfoForm.getAllocationRatio()); + } + +} From 170e319dca349fb5a8a4a26adb8c0525b6ac0061 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 17 Sep 2026 14:31:35 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[ADD]=20CourseInfoModel=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/domain/model/CourseInfoModel.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/java/com/example/demo/app/domain/model/CourseInfoModel.java diff --git a/src/main/java/com/example/demo/app/domain/model/CourseInfoModel.java b/src/main/java/com/example/demo/app/domain/model/CourseInfoModel.java new file mode 100644 index 0000000..45d0dd9 --- /dev/null +++ b/src/main/java/com/example/demo/app/domain/model/CourseInfoModel.java @@ -0,0 +1,20 @@ +package com.example.demo.app.domain.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class CourseInfoModel { + + private Long courseId; + + private String courseName; + + private Long categoryId; + + private String categoryName; + + private Integer allocationRatio; + +} From 2e64d623b5b2d9b7cf6ab30fbc45302a71efb473 Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 17 Sep 2026 14:32:48 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[FIX]=20=E4=B8=BB=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E5=9E=8B=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/demo/app/infra/entity/GoalEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java b/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java index 7dc7068..f4bbe50 100644 --- a/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java +++ b/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java @@ -24,7 +24,7 @@ public class GoalEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "goal_id") - private Integer goalId; + private Long goalId; @Column(name = "goal_title", nullable = true) private String goalTitle; From 804e4a6fddad550c8577ea96a842510c59df789e Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 17 Sep 2026 14:51:11 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[FIX]=20JQPL=E3=81=AE=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E5=90=8D=E3=81=A8=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB=E5=90=8D?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/AllocationRepository.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java b/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java index 56913d8..5dc0ece 100644 --- a/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java +++ b/src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java @@ -13,19 +13,20 @@ public interface AllocationRepository extends JpaRepository findByCourseEntity_CourseId(Long courseId); - @Query(" SELECT co.course_id, " - + " co.course_name, " - + " ca.category_id, " - + " ca.categpry_name, " - + " a.allocation_ratio " - + " FROM allocation_m a " - + " INNER JOIN course_m co " - + " ON a.course_id = co.course_id " - + " INNER JOIN category_t ca " - + " on a.category_id = ca.category_id " - + " WHERE ca.transaction_type = 0 " - + " ORDER BY a.course_id ASC, " - + " a.category_id ASC ") + @Query(" SELECT new com.example.demo.app.domain.model.CourseInfoModel(" + + "co.courseId, " + + " co.courseName, " + + " ca.categoryId, " + + " ca.categoryName, " + + " a.allocationRatio )" + + " FROM AllocationEntity a" + + " INNER JOIN CourseEntity co " + + " ON a.courseEntity.courseId = co.courseId " + + " INNER JOIN CategoryEntity ca " + + " on a.categoryEntity.categoryId = ca.categoryId " + + " WHERE ca.transactionType = 0 " + + " ORDER BY a.courseEntity.courseId ASC, " + + " a.categoryEntity.categoryId ASC ") List findAllJoinedAllocation(); } From 86e41765f59e7046278c37774c7fc6e573dea840 Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 17 Sep 2026 14:52:24 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[FIX]=20JPQL=E3=81=AE=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/app/infra/repository/TransactionRepository.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java index c747917..5fe10a1 100644 --- a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java +++ b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java @@ -13,13 +13,13 @@ public interface TransactionRepository extends JpaRepository findByUserIdAndDate(LocalDate todayDate, Long userId); - @Query("select t from TransactionEntity t where (t.transactionDate between :startDate and :endDate) and (t.userId = :userId) order by t.transactionDate asc") + @Query("select t from TransactionEntity t where (t.transactionDate between :startDate and :endDate) and (t.userEntity.userId = :userId) order by t.transactionDate asc") public List findAllByDateAndUserId(LocalDate startDate, LocalDate endDate, Long userId); - @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryId = c.categoryId where (t.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0") + @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0") public Integer findTotalExpense(LocalDate startDate, LocalDate endDate, Long userId); - @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryId = c.categoryId where (t.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1") + @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1") public Integer findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId); @Query("select sum(t.amount) from TransactionEntity t where t.userEntity.userId = :userId and t.categoryEntity.categoryId = :categoryId and t.transactionDate between :startDate and :endDate") From 1b6193082d60014645b1f4c6fc7886856f54ca89 Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 17 Sep 2026 14:52:46 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=E3=80=8CFIX]=20=E5=8F=8E=E6=94=AF=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=81=AEURL=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/controller/TransactionController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java index 35fec08..fed0ca7 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java @@ -66,7 +66,7 @@ public class TransactionController { } // 詳細画面 - @GetMapping() + @GetMapping("/transaction/detail") public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) { LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates; @@ -93,13 +93,13 @@ public class TransactionController { return ""; } - @GetMapping("") + @GetMapping("/transaction/create") public String createOneGet(@ModelAttribute TransactionForm transactionForm) { return ""; } - @PostMapping() + @PostMapping("/transaction/create") public String createOnePost(@ModelAttribute TransactionForm transactionForm, Model model) { if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) { @@ -110,13 +110,13 @@ public class TransactionController { } - @GetMapping("") + @GetMapping("/transaction/update") public String updateOneGet(@ModelAttribute TransactionForm transactionForm) { return ""; } - @PostMapping() + @PostMapping("/transaction/update") public String updateOnePost(@ModelAttribute TransactionForm transactionForm, Model model) { if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {