diff --git a/src/main/java/com/example/springdemo/controller/MerchantsController.java b/src/main/java/com/example/springdemo/controller/MerchantsController.java index 91d56ec..463763e 100644 --- a/src/main/java/com/example/springdemo/controller/MerchantsController.java +++ b/src/main/java/com/example/springdemo/controller/MerchantsController.java @@ -1,12 +1,11 @@ package com.example.springdemo.controller; import com.example.springdemo.entities.Merchants; +import com.example.springdemo.entities.password.MerchantsPassword; import com.example.springdemo.service.MerchantsService; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.*; -import java.util.Optional; - @RestController @RequestMapping("/merchants") public class MerchantsController { @@ -14,16 +13,17 @@ public class MerchantsController { private MerchantsService merchantsService; @PostMapping("/add") - public Merchants addMerchants(@RequestBody Merchants merchants) { - return merchantsService.addMerchants(merchants); + public Merchants addMerchants(@RequestBody Merchants merchants, + @RequestBody MerchantsPassword merchantsPassword) { + return merchantsService.addMerchants(merchants, merchantsPassword); } @DeleteMapping("/delete/{id}") - public void deleteMerchants(@PathVariable("id") Long id) { - merchantsService.deleteMerchantsById(id); + public void deleteMerchants(@PathVariable("id") Long merchantID) { + merchantsService.deleteMerchantsById(merchantID); } - @PutMapping("/update") + @PutMapping("/update/info") public Merchants updateMerchants(@RequestBody Merchants merchants) { return merchantsService.updateMerchants(merchants); } @@ -39,7 +39,12 @@ public class MerchantsController { } @GetMapping("/find/{id}") - public Merchants getMerchantsById(@PathVariable("id") Long id) { - return merchantsService.findById(id); + public Merchants getMerchantsById(@PathVariable("id") Long merchantID) { + return merchantsService.findById(merchantID); + } + + @PutMapping("/update/password") + public void updatePassword(@RequestParam String password, @RequestParam Long merchantID) { + merchantsService.updatePassword(password, merchantID); } }