Compare commits
4 Commits
603d0d083a
...
a2b1922548
| Author | SHA1 | Date | |
|---|---|---|---|
| a2b1922548 | |||
| 1386f4b886 | |||
| d696d8f376 | |||
| 066d76148b |
@@ -0,0 +1,63 @@
|
||||
package com.example.demo.app.domain.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.infra.entity.CourseEntity;
|
||||
import com.example.demo.app.infra.entity.GoalEntity;
|
||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||
import com.example.demo.app.infra.entity.UserEntity;
|
||||
import com.example.demo.app.infra.repository.CourseRepository;
|
||||
import com.example.demo.app.infra.repository.GoalRepository;
|
||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||
import com.example.demo.app.infra.repository.UserRepository;
|
||||
import com.example.demo.app.presentation.form.UserForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserServiceImpl implements UserService {
|
||||
private final UserRepository userRepository;
|
||||
private final QuestionRepository questionRepository;
|
||||
private final GoalRepository goalRepository;
|
||||
private final CourseRepository courseRepository;
|
||||
|
||||
@Override
|
||||
public void register(UserForm userForm) {
|
||||
|
||||
UserEntity userEntity = new UserEntity();
|
||||
|
||||
userEntity.setUserName(userForm.getUserName());
|
||||
userEntity.setMailAddress(userForm.getMailAddress());
|
||||
userEntity.setPassword(userForm.getPassword());
|
||||
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
||||
userEntity.setBirthDate(userForm.getBirthDate());
|
||||
userEntity.setSaving(userForm.getSaving());
|
||||
userEntity.setBirthDate(userForm. getBirthDate());
|
||||
userEntity.setSaving(userForm.getSaving());
|
||||
userEntity.setAnnualIncome(userForm.getAnnualIncome());
|
||||
userEntity.setMonthlyBudget(userForm.getMonthlyBudget());
|
||||
|
||||
QuestionEntity questionEntity =
|
||||
questionRepository.findById(userForm.getSecretQuestionId()).orElse(null);
|
||||
|
||||
GoalEntity goalEntity =
|
||||
goalRepository.findById(userForm.getGoalId()).orElse(null);
|
||||
|
||||
CourseEntity courseEntity =
|
||||
courseRepository.findById(userForm.getCourseId()).orElse(null);
|
||||
|
||||
userEntity.setQuestionEntity(questionEntity);
|
||||
userEntity.setGoalEntity(goalEntity);
|
||||
userEntity.setCourseEntity(courseEntity);
|
||||
|
||||
userEntity.setDeleteFlag(0);
|
||||
|
||||
userRepository.save(userEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div th:replace="~{footer :: footer}">
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
42
src/main/resources/templates/footer.html
Normal file
42
src/main/resources/templates/footer.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>フッター</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<footer th:fragment="footer" class="fixed-bottom border-top py-2" style="background-color:#E3F2FD;">
|
||||
|
||||
<nav data-bs-theme="light">
|
||||
<div class="card-footer text-center">
|
||||
<div class="row">
|
||||
<div class="col border-end">
|
||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||
<a th:href="@{/transaction/create}">入力</a>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col border-end">
|
||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||
<a th:href="@{/transaction/list}">一覧</a>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col border-end">
|
||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||
<a th:href="@{/analysis}">分析</a>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col border-end">
|
||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||
<a th:href="@{/goal}">目標</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</footer>
|
||||
<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