Browse Source

班级id校验不能为空

肖玮 5 years ago
parent
commit
41f909305d

+ 2 - 1
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import javax.validation.Valid;
 
 /**
  * @program: mec
@@ -29,7 +30,7 @@ public class CourseScheduleController {
 
     @PostMapping("/list")
     @ApiOperation("课表列表")
-    public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
+    public PageResponse list(@RequestBody @Valid ClassGroupReq classGroupReq) {
         return courseScheduleService.getPage(classGroupReq);
     }
 }

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java

@@ -4,6 +4,8 @@ import com.ym.mec.education.base.BaseQuery;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 /**
@@ -17,6 +19,7 @@ import java.io.Serializable;
 public class ClassGroupReq extends BaseQuery implements Serializable {
 
     @ApiModelProperty(value = "班级id",required = true)
+    @NotNull(message = "班级id不能为空")
     private Integer groupId;
 
     private Integer type = 0;