Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package com.example.demo.app.domain.model;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TransactionModel {
|
||||||
|
|
||||||
|
private Long transactionId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
private LocalDate transactionDate;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
|
public interface TransactionService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TransactionServiceImpl implements TransactionService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ public class TransactionEntity {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "transaction_id")
|
@Column(name = "transaction_id")
|
||||||
private Integer transactionId;
|
private Long transactionId;
|
||||||
|
|
||||||
@Column(name = "amount", nullable = false)
|
@Column(name = "amount", nullable = false)
|
||||||
private Integer amount;
|
private Integer amount;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.AllocationEntity;
|
||||||
|
import com.example.demo.app.infra.entity.TransactionEntity;
|
||||||
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
|
|
||||||
|
public interface AnalysisRepository {
|
||||||
|
|
||||||
|
List<TransactionEntity> findExpenseByPeriod(
|
||||||
|
Integer userId,
|
||||||
|
LocalDate startDate,
|
||||||
|
LocalDate endDate);
|
||||||
|
|
||||||
|
List<AllocationEntity> findAllocationByCourseId(
|
||||||
|
Integer courseId);
|
||||||
|
|
||||||
|
UserEntity findUserByUserId(
|
||||||
|
Integer userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.TransactionEntity;
|
||||||
|
|
||||||
|
public interface TransactionRepository extends JpaRepository<TransactionEntity, Long>{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,10 +2,16 @@ package com.example.demo.app.presentation.controller;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SelectTransactionController {
|
public class TransactionController {
|
||||||
|
|
||||||
|
private final TransactionService transactionService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.example.demo.app.presentation.form;
|
package com.example.demo.app.presentation.form;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.TransactionModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -9,6 +14,27 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class TransactionForm {
|
public class TransactionForm {
|
||||||
|
|
||||||
|
private Long transactionId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
private LocalDate transactionDate;
|
||||||
|
|
||||||
|
public static TransactionForm convertFrom(TransactionModel transactionModel) {
|
||||||
|
return new TransactionForm(
|
||||||
|
transactionModel.getTransactionId(),
|
||||||
|
transactionModel.getUserId(),
|
||||||
|
transactionModel.getCategoryId(),
|
||||||
|
transactionModel.getAmount(),
|
||||||
|
transactionModel.getTransactionDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<TransactionForm> convertFrom(List<TransactionModel> transactionModelList) {
|
||||||
|
return transactionModelList.stream().map(TransactionForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user