Compare commits
11 Commits
073ed5e864
...
d65a84ea79
| Author | SHA1 | Date | |
|---|---|---|---|
| d65a84ea79 | |||
| fbd1746776 | |||
| 9bc5bd20ac | |||
| 5506f5884b | |||
| a6a9cb0b63 | |||
|
|
1369d839af | ||
|
|
7f454b852a | ||
| 83e97b7ec1 | |||
|
|
f1b5e3eaf8 | ||
|
|
59cec2fed7 | ||
|
|
743fe20e9a |
@@ -1,8 +1,9 @@
|
||||
package com.example.demo.app.domain.service;
|
||||
package com.example.demo.app.domain.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.model.AnalysisModel;
|
||||
import com.example.demo.app.domain.service.AnalysisService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.example.demo.app.infra.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.example.demo.app.infra.entity.AllocationEntity;
|
||||
|
||||
public interface AllocationRepository extends JpaRepository<AllocationEntity, Long>{
|
||||
|
||||
List<AllocationEntity> findByCourseId(Long courseId);
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@ public interface TransactionRepository extends JpaRepository<TransactionEntity,
|
||||
@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")
|
||||
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")
|
||||
public Integer findCategoryExpense(LocalDate startDate, LocalDate endDate, Long userId, Long categoryId);
|
||||
}
|
||||
|
||||
60
src/main/resources/templates/analysis.html
Normal file
60
src/main/resources/templates/analysis.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||
<title>分析画面</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2 class="text-center">支出分析</h2>
|
||||
|
||||
<table class="table text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">カテゴリ別</th>
|
||||
<th scope="col">支出</th>
|
||||
<th scope="col">前月比</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">総支出</th>
|
||||
<td>¥234,000</td>
|
||||
<td>+¥38,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<hr class="border border-primary border-2 opacity-50">
|
||||
|
||||
<table class="table text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">カテゴリ別</th>
|
||||
<th scope="col">支出</th>
|
||||
<th scope="col">前月比<br>コース比</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">食費</th>
|
||||
<td>¥34,000</td>
|
||||
<td>+¥8,000<br>+¥1,100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">交通費</th>
|
||||
<td>¥14,000</td>
|
||||
<td>+¥8,000<br>+¥1,100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">日用品</th>
|
||||
<td>¥4,000</td>
|
||||
<td>+¥8,000<br>+¥1,100</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user