15 Commits

Author SHA1 Message Date
ce0a158988 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:23:41 +09:00
54b909d00d [ADD] 目標のためのModelを作成しました。 2026-09-17 14:22:06 +09:00
kkazuya
0c19adb63f Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 14:20:43 +09:00
kkazuya
f86d47c17a [EDIT] AllocationRepositoryにコース一覧に表示するデータを取得する@Queryを追加しました 2026-09-17 14:20:34 +09:00
a98554ac69 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 14:17:43 +09:00
s-choi
cf31d03415 [FIX] IDの型を修正しました。 2026-09-17 14:16:19 +09:00
s-choi
80d83b96f4 [FIX] import及び型の修正を行いました。 2026-09-17 14:15:59 +09:00
kkazuya
7f828657ad [ADD] Allocation, CourseのModelを追加しました。 2026-09-17 14:09:06 +09:00
kkazuya
064b74c49b Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 14:04:29 +09:00
kkazuya
4fc69cddb3 [EDIT] Course, AllocationEntityのテーブル名を修正 2026-09-17 14:04:20 +09:00
s-choi
c7e68f6a4f [EDIT] Table名を変更しました。 2026-09-17 14:03:13 +09:00
s-choi
083ad8644d [EDIT] Viewの遷移先アドレスを変更しました。 2026-09-17 14:02:54 +09:00
72477d014b Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 13:02:47 +09:00
kkazuya
792172664c Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 12:44:49 +09:00
kkazuya
882212aed5 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 11:24:54 +09:00
12 changed files with 124 additions and 12 deletions

View File

@@ -0,0 +1,14 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class AllocationModel {
private Long categoryId;
private Long courseId;
private Integer allocationRatio;
}

View File

@@ -0,0 +1,28 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CourseEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CourseModel {
private Long courseId;
private String courseName;
private String description;
public static CourseModel convertFrom(CourseEntity courseEntity) {
return new CourseModel(
courseEntity.getCourseId(),
courseEntity.getCourseName(),
courseEntity.getDescription());
}
public static List<CourseModel> convertFrom(List<CourseEntity> courseEntityList) {
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
}
}

View File

@@ -0,0 +1,24 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class GoalModel {
private Long goalId;
private String goalTitle;
private String goalSubtitle;
private Integer targetAmount;
private LocalDate deadline;
private Integer goalComplete;
}

View File

@@ -1,5 +1,7 @@
package com.example.demo.app.infra.entity;
import java.util.List;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
@@ -9,12 +11,14 @@ import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import com.example.demo.app.domain.model.AllocationModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "allocation")
@Table(name = "allocation_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
@@ -32,5 +36,16 @@ public class AllocationEntity {
@Column(name = "allocation_ratio", nullable = false)
private Integer allocationRatio;
public static List<AllocationModel> createAllocationModelList(List<AllocationEntity> allocationEntityList) {
return allocationEntityList
.stream()
.map(allocationEntity -> new AllocationModel(
allocationEntity.getCategoryEntity().getCategoryId(),
allocationEntity.getCourseEntity().getCourseId(),
allocationEntity.getAllocationRatio()
)).toList();
}
}

View File

@@ -15,7 +15,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "category")
@Table(name = "category_t")
@Data
@NoArgsConstructor
@AllArgsConstructor

View File

@@ -6,18 +6,19 @@ import jakarta.persistence.Column;
import jakarta.persistence.Entity;
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 org.springframework.data.annotation.Id;
import com.example.demo.app.domain.model.CourseModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "course")
@Table(name = "course_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
@@ -39,6 +40,18 @@ public class CourseEntity {
private List<UserEntity> userEntity;
@OneToOne(mappedBy = "courseEntity")
private List<AllocationEntity> allocationEntity;
private AllocationEntity allocationEntity;
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
return courseEntityList
.stream()
.map(courseEntity -> new CourseModel(
courseEntity.getCourseId(),
courseEntity.getCourseName(),
courseEntity.getDescription()
)).toList();
}
}

View File

@@ -15,7 +15,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "goal")
@Table(name = "goal_t")
@Data
@NoArgsConstructor
@AllArgsConstructor

View File

@@ -15,7 +15,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "question")
@Table(name = "question_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
@@ -24,12 +24,12 @@ public class QuestionEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "secret_question_id")
private Integer secretQuestionId;
private Long secretQuestionId;
@Column(name = "question_text", nullable = false)
private String questionText;
@OneToMany(mappedBy = "QuestionEntity")
@OneToMany(mappedBy = "questionEntity")
private List<UserEntity> userEntity;
}

View File

@@ -17,7 +17,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "transaction")
@Table(name = "transaction_t")
@Data
@NoArgsConstructor
@AllArgsConstructor

View File

@@ -3,10 +3,28 @@ package com.example.demo.app.infra.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.domain.model.CourseInfoModel;
import com.example.demo.app.infra.entity.AllocationEntity;
public interface AllocationRepository extends JpaRepository<AllocationEntity, Long>{
List<AllocationEntity> findByCourseId(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 ")
List<CourseInfoModel> findAllJoinedAllocation();
}

View File

@@ -7,5 +7,5 @@ import com.example.demo.app.infra.entity.GoalEntity;
@Repository
public interface GoalRepository extends JpaRepository<GoalEntity, Long> {
//aaa
}

View File

@@ -62,7 +62,7 @@ public class TransactionController {
model.addAttribute("transactionFormMap", transactionFormMap);
return "transactionList";
return "transaction_list";
}
// 詳細画面