Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
de9d3ecb
提交
de9d3ecb
authored
4月 19, 2024
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 示例接口更新
上级
753bfbfd
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
HealthController.java
...main/java/com/yiring/app/web/common/HealthController.java
+0
-2
ExampleController.java
...in/java/com/yiring/app/web/example/ExampleController.java
+15
-3
没有找到文件。
app/src/main/java/com/yiring/app/web/common/HealthController.java
浏览文件 @
de9d3ecb
...
@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
...
@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
jakarta.servlet.http.HttpServletResponse
;
import
jakarta.servlet.http.HttpServletResponse
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -31,7 +30,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -31,7 +30,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
HealthController
{
public
class
HealthController
{
final
ApplicationContext
applicationContext
;
final
Redis
redis
;
final
Redis
redis
;
final
Minio
minio
;
final
Minio
minio
;
final
UserRepository
userRepository
;
final
UserRepository
userRepository
;
...
...
app/src/main/java/com/yiring/app/web/example/ExampleController.java
浏览文件 @
de9d3ecb
...
@@ -73,9 +73,13 @@ public class ExampleController {
...
@@ -73,9 +73,13 @@ public class ExampleController {
*/
*/
@Operation
(
summary
=
"测试失败"
)
@Operation
(
summary
=
"测试失败"
)
@GetMapping
(
"fail"
)
@GetMapping
(
"fail"
)
public
Result
<
String
>
fail
()
{
public
void
fail
()
{
// throw BusinessException.i18n("Code.1");
// 1. 直接抛出异常
throw
new
RuntimeException
(
"test fail"
);
Status
.
BAD_REQUEST
.
expose
(
"Code.1"
);
// 2. 手动抛出异常
// throw Status.BAD_REQUEST.exception("Code.1");
// throw BusinessException.i18n("Code.1");
// throw new FailStatusException(Status.BAD_REQUEST, "Code.1");
}
}
@SaCheckLogin
@SaCheckLogin
...
@@ -83,6 +87,14 @@ public class ExampleController {
...
@@ -83,6 +87,14 @@ public class ExampleController {
@GetMapping
(
"page"
)
@GetMapping
(
"page"
)
public
Result
<
PageVo
<
String
>>
page
(
@ParameterObject
@Validated
PageParam
param
)
{
public
Result
<
PageVo
<
String
>>
page
(
@ParameterObject
@Validated
PageParam
param
)
{
log
.
debug
(
"PageParam: {}"
,
param
);
log
.
debug
(
"PageParam: {}"
,
param
);
log
.
debug
(
"Pageable: {}"
,
PageParam
.
toPageable
(
param
));
// 常用的分页、条件查询工具类函数
// 1. Specifications.of()
// 2. Specifications.exist()
// 3. PageParam.toPageable()
// 4. PageVo.build()/PageVo.toPageVo()
// 5. RepositoryUtil.find()
String
text
=
i18n
.
get
(
"example.hello"
);
String
text
=
i18n
.
get
(
"example.hello"
);
List
<
String
>
data
=
Arrays
.
asList
(
text
.
split
(
" "
));
List
<
String
>
data
=
Arrays
.
asList
(
text
.
split
(
" "
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论