使用spring-ai-alibaba重构项目

This commit is contained in:
2025-10-22 19:53:26 +08:00
parent fac1346104
commit 5fb4ed754c
2 changed files with 37 additions and 4 deletions

View File

@@ -0,0 +1,22 @@
package com.qingqiu.interview.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").
allowedOriginPatterns("*") //允许跨域的域名,可以用*表示允许任何域名使用
// allowedOrigins("*"). //在Springboot2.4对应Spring5.3后在设置allowCredentials(true)的基础上不能直接使用通配符设置allowedOrigins而是需要指定特定的URL。如果需要设置通配符需要通过allowedOriginPatterns指定
.allowedMethods("GET", "POST", "DELETE", "PUT") //允许任何方法post、get等
.allowedHeaders("*") //允许任何请求头
.allowCredentials(true) //带上cookie信息
.exposedHeaders(HttpHeaders.SET_COOKIE).maxAge(3600L); //maxAge(3600)表明在3600秒内不需要再发送预检验请求可以缓存该结果
}
}

View File

@@ -3,12 +3,10 @@ package com.qingqiu.interview.controller;
import com.qingqiu.interview.common.res.R; import com.qingqiu.interview.common.res.R;
import com.qingqiu.interview.dto.QuestionProgressPageParams; import com.qingqiu.interview.dto.QuestionProgressPageParams;
import com.qingqiu.interview.entity.InterviewQuestionProgress;
import com.qingqiu.interview.service.IInterviewQuestionProgressService; import com.qingqiu.interview.service.IInterviewQuestionProgressService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* <p> * <p>
@@ -27,6 +25,7 @@ public class InterviewQuestionProgressController {
/** /**
* 面试问题进度列表 * 面试问题进度列表
*
* @param params 查询参数 * @param params 查询参数
* @return data * @return data
*/ */
@@ -35,4 +34,16 @@ public class InterviewQuestionProgressController {
return R.success(service.pageList(params)); return R.success(service.pageList(params));
} }
/**
* 获取面试问题进度详情
*
* @param id id
* @return data
*/
@GetMapping("/{id}")
public R<InterviewQuestionProgress> getDetail(@PathVariable Long id) {
return R.success(service.getById(id));
}
} }