no message
Showing
3 changed files
with
9 additions
and
3 deletions
| ... | @@ -17,6 +17,7 @@ import lombok.RequiredArgsConstructor; | ... | @@ -17,6 +17,7 @@ import lombok.RequiredArgsConstructor; |
| 17 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
| 18 | 18 | ||
| 19 | import javax.servlet.http.HttpServletRequest; | 19 | import javax.servlet.http.HttpServletRequest; |
| 20 | import javax.validation.Valid; | ||
| 20 | import java.rmi.ServerException; | 21 | import java.rmi.ServerException; |
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| ... | @@ -51,7 +52,7 @@ public class QuestionController extends BaseController { | ... | @@ -51,7 +52,7 @@ public class QuestionController extends BaseController { |
| 51 | */ | 52 | */ |
| 52 | @RepeatSubmit() | 53 | @RepeatSubmit() |
| 53 | @PostMapping() | 54 | @PostMapping() |
| 54 | public R<Void> addQuestion(@RequestBody QuestionBo QuestionBo) throws ServerException { | 55 | public R<Void> addQuestion(@RequestBody @Valid QuestionBo QuestionBo) throws ServerException { |
| 55 | return toAjax(service.addQuestion(QuestionBo)); | 56 | return toAjax(service.addQuestion(QuestionBo)); |
| 56 | } | 57 | } |
| 57 | 58 | ||
| ... | @@ -63,7 +64,7 @@ public class QuestionController extends BaseController { | ... | @@ -63,7 +64,7 @@ public class QuestionController extends BaseController { |
| 63 | */ | 64 | */ |
| 64 | @RepeatSubmit() | 65 | @RepeatSubmit() |
| 65 | @PutMapping | 66 | @PutMapping |
| 66 | public R<Void> updateQuestion(@RequestBody QuestionBo QuestionBo) throws ServerException { | 67 | public R<Void> updateQuestion(@RequestBody @Valid QuestionBo QuestionBo) throws ServerException { |
| 67 | return toAjax(service.updateQuestion(QuestionBo)); | 68 | return toAjax(service.updateQuestion(QuestionBo)); |
| 68 | } | 69 | } |
| 69 | 70 | ... | ... |
| ... | @@ -71,12 +71,12 @@ public class CourseBo extends BaseBO { | ... | @@ -71,12 +71,12 @@ public class CourseBo extends BaseBO { |
| 71 | /** | 71 | /** |
| 72 | * 案例OSS_id | 72 | * 案例OSS_id |
| 73 | */ | 73 | */ |
| 74 | @NotBlank(message = "案例不能为空") | ||
| 74 | private String caseOssId; | 75 | private String caseOssId; |
| 75 | 76 | ||
| 76 | /** | 77 | /** |
| 77 | * 教案OSS_id | 78 | * 教案OSS_id |
| 78 | */ | 79 | */ |
| 79 | @NotBlank(message = "教案不能为空") | ||
| 80 | private String teachingOssId; | 80 | private String teachingOssId; |
| 81 | 81 | ||
| 82 | /** | 82 | /** | ... | ... |
| ... | @@ -2,6 +2,9 @@ package com.lego.core.domin.bo; | ... | @@ -2,6 +2,9 @@ package com.lego.core.domin.bo; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | import javax.validation.constraints.NotBlank; | ||
| 6 | import javax.validation.constraints.Size; | ||
| 7 | |||
| 5 | /** | 8 | /** |
| 6 | * 问题请求对象 core_question | 9 | * 问题请求对象 core_question |
| 7 | * | 10 | * |
| ... | @@ -22,6 +25,8 @@ public class QuestionBo extends BaseBO { | ... | @@ -22,6 +25,8 @@ public class QuestionBo extends BaseBO { |
| 22 | /** | 25 | /** |
| 23 | * 问题标题 | 26 | * 问题标题 |
| 24 | */ | 27 | */ |
| 28 | @NotBlank(message = "问题不能为空") | ||
| 29 | @Size(min = 0, max = 50, message = "问题长度不能超过{max}个字符") | ||
| 25 | private String title; | 30 | private String title; |
| 26 | 31 | ||
| 27 | /** | 32 | /** | ... | ... |
-
Please register or sign in to post a comment