Commit 416a6476 authored by keita.onoguchi's avatar keita.onoguchi

ウォレット機能途中

parent c363330c
......@@ -5,18 +5,14 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.domain.BadRequestException;
import com.example.domain.Wallets;
import com.example.repository.WalletsRepository;
import com.example.web.EcsiteController;
//ユーザウォレットのサービス
@Service
public class WalletsService {
@Autowired
WalletsRepository walletsRepository;
@Autowired
Wallets wallet;
public List<Wallets> findAll(){
return walletsRepository.findAll();
......@@ -37,6 +33,7 @@ public class WalletsService {
//支払い処理
public Wallets pay(Integer id, Integer amount){
//対象の財布情報を取得
Wallets wallet = new Wallets();
wallet = this.findOne(id);
wallet.setAmount(wallet.getAmount() - amount);
return walletsRepository.save(wallet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment