删除crossOrigin,添加总RequestMapping

This commit is contained in:
高子兴 2024-07-05 23:36:52 +08:00
parent fca88ffd68
commit a57b4be921

View File

@ -2,32 +2,31 @@ package org.cmh.backend.UserManagement.controller;
import jakarta.transaction.Transactional;
import org.cmh.backend.UserManagement.model.Tenant;
import org.cmh.backend.UserManagement.service.TenantManagementService;
import org.cmh.backend.UserManagement.model.User;
import org.cmh.backend.UserManagement.service.TenantManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/tenant")
public class TenantManagementController {
@Autowired
private TenantManagementService tenantManagementService;
@CrossOrigin(origins = "http://localhost:5173")
@PostMapping("/addTenant")
public Tenant addTenant(@RequestBody Tenant tenant) {
Tenant tenant1=tenantManagementService.registerTenant(tenant);
Tenant tenant1 = tenantManagementService.registerTenant(tenant);
System.out.println(tenant.toString());
return tenant1;
}
@CrossOrigin(origins = "http://localhost:5173")
@GetMapping("/getAllTenant")
public List<Tenant> getAll() {
return tenantManagementService.findAll();
}
@CrossOrigin(origins = "http://localhost:5173")
@PostMapping("/updateTenant")
public Tenant update(@RequestBody Tenant tenant) {
System.out.println(tenant);
@ -35,7 +34,6 @@ public class TenantManagementController {
return tenant;
}
@CrossOrigin(origins = "http://localhost:5173")
@PostMapping("/deleteTenant")
@Transactional
public void delete(@RequestBody User user) {