This repository was archived by the owner on Nov 29, 2023. It is now read-only.
File tree 1 file changed +59
-36
lines changed
1 file changed +59
-36
lines changed Original file line number Diff line number Diff line change 1
- # validator
1
+ ## SpringMvc 参数校验注解扩展包
2
+
3
+ 定义了一些` SpringMVC ` 通用的参数校验注解,轻松实现入参的校验,提高接口的健壮性,避免生成一些不必要的脏数据
4
+
5
+ ### 使用
6
+
7
+ ``` xml
8
+ <repository >
9
+ <id >ease-maven</id >
10
+ <url >https://code4everything.gitee.io/repository/maven</url >
11
+ </repository >
12
+ ```
13
+
14
+ ``` xml
15
+ <dependency >
16
+ <groupId >org.code4everything</groupId >
17
+ <artifactId >validator</artifactId >
18
+ <version >1.0.0</version >
19
+ </dependency >
20
+ ```
21
+
22
+ ### 校验Body
23
+
24
+ ``` java
25
+ @Data
26
+ public class BodyVO {
27
+
28
+ @Chinese (has = true )
29
+ private String chinese;
30
+
31
+ @EndWith (" suffix" )
32
+ private String suffix;
33
+ }
34
+ ```
35
+
36
+ ``` java
37
+ @RestController
38
+ public class TestController {
39
+
40
+ @GetMapping (" /validation/body" )
41
+ public String validateBody (@Valid @RequestBody BodyVO bodyVO ) {
42
+ return " success" ;
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### 校验参数
48
+
49
+ ``` java
50
+ @Validated
51
+ @RestController
52
+ public class TestController {
53
+
54
+ @GetMapping (" /validation/body" )
55
+ public String validateQueryString (@Letter (lowerCase = true ) String letter , @Mobile String phoneNumber ) {
56
+ return " success" ;
57
+ }
58
+ }
59
+ ```
2
60
3
- #### 介绍
4
- java validator
5
-
6
- #### 软件架构
7
- 软件架构说明
8
-
9
-
10
- #### 安装教程
11
-
12
- 1 . xxxx
13
- 2 . xxxx
14
- 3 . xxxx
15
-
16
- #### 使用说明
17
-
18
- 1 . xxxx
19
- 2 . xxxx
20
- 3 . xxxx
21
-
22
- #### 参与贡献
23
-
24
- 1 . Fork 本仓库
25
- 2 . 新建 Feat_xxx 分支
26
- 3 . 提交代码
27
- 4 . 新建 Pull Request
28
-
29
-
30
- #### 码云特技
31
-
32
- 1 . 使用 Readme\_ XXX.md 来支持不同的语言,例如 Readme\_ en.md, Readme\_ zh.md
33
- 2 . 码云官方博客 [ blog.gitee.com] ( https://blog.gitee.com )
34
- 3 . 你可以 [ https://gitee.com/explore ] ( https://gitee.com/explore ) 这个地址来了解码云上的优秀开源项目
35
- 4 . [ GVP] ( https://gitee.com/gvp ) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
36
- 5 . 码云官方提供的使用手册 [ https://gitee.com/help ] ( https://gitee.com/help )
37
- 6 . 码云封面人物是一档用来展示码云会员风采的栏目 [ https://gitee.com/gitee-stars/ ] ( https://gitee.com/gitee-stars/ )
You can’t perform that action at this time.
0 commit comments