bug fix: Ambiguous mapping. Cannot map ‘***’ method

This commit is contained in:
myh 2023-11-11 20:19:04 +08:00
parent 02dddf6699
commit 469253559e

View File

@ -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);
}
}