Compare commits
8 Commits
3e2af36bfb
...
acd31c9f2a
| Author | SHA1 | Date | |
|---|---|---|---|
| acd31c9f2a | |||
| 842f2b55f8 | |||
|
|
c093fcad24 | ||
|
|
bae92ded58 | ||
|
|
210579de68 | ||
|
|
05797d47d4 | ||
|
|
0561541bec | ||
|
|
a800606bb2 |
@@ -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
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "transaction_id")
|
||||
private Integer transactionId;
|
||||
private Long transactionId;
|
||||
|
||||
@Column(name = "amount", nullable = false)
|
||||
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 com.example.demo.app.domain.service.TransactionService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class SelectTransactionController {
|
||||
public class TransactionController {
|
||||
|
||||
private final TransactionService transactionService;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
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.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -9,6 +14,27 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
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