增加 参数校验,以防报NPE

pull/26/head
3y 2 years ago
parent 6eb61aea10
commit 011fb9f3c9

@ -23,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -73,7 +74,7 @@ public class MessageTemplateController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("/列表页") @ApiOperation("/列表页")
public BasicResultVO queryList(MessageTemplateParam messageTemplateParam) { public BasicResultVO queryList(@Validated MessageTemplateParam messageTemplateParam) {
List<Map<String, Object>> result = ConvertMap.flatList(messageTemplateService.queryList(messageTemplateParam)); List<Map<String, Object>> result = ConvertMap.flatList(messageTemplateService.queryList(messageTemplateParam));
long count = messageTemplateService.count(); long count = messageTemplateService.count();

@ -5,6 +5,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/** /**
* *
* *
@ -20,11 +23,13 @@ public class MessageTemplateParam {
/** /**
* *
*/ */
@NotNull
private Integer page; private Integer page;
/** /**
* *
*/ */
@NotNull
private Integer perPage; private Integer perPage;
/** /**

Loading…
Cancel
Save