diff --git a/src/main/java/edu/zrh/healthsystem/config/WebLoginConfig.java b/src/main/java/edu/zrh/healthsystem/config/WebLoginConfig.java index e1bc9be..6bbe6ef 100644 --- a/src/main/java/edu/zrh/healthsystem/config/WebLoginConfig.java +++ b/src/main/java/edu/zrh/healthsystem/config/WebLoginConfig.java @@ -10,14 +10,9 @@ public class WebLoginConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") - // 对所有路径应用此规则 .allowedOrigins("http://localhost:3000") - // 允许来自这个源的请求 .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - // 允许的HTTP方法 - .allowedHeaders("Authorization", "*") - // 允许的请求头 + .allowedHeaders("*") .allowCredentials(true); - // 允许发送Cookie } } diff --git a/src/main/java/edu/zrh/healthsystem/controller/TemplateController.java b/src/main/java/edu/zrh/healthsystem/controller/TemplateController.java new file mode 100644 index 0000000..1e846cf --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/TemplateController.java @@ -0,0 +1,44 @@ +package edu.zrh.healthsystem.controller; + +import edu.zrh.healthsystem.entity.Template; // 假设你有一个Template实体类 +import edu.zrh.healthsystem.service.TemplateService; // 假设你有一个TemplateService类 +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/api/templates") +public class TemplateController { + + @Autowired + private TemplateService templateService; + + @PostMapping + public ResponseEntity