欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

springboot 单个参数校验

程序员文章站 2022-07-13 14:27:11
...


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sys/dictionary")
@Api(tags="数据字典接口")
@Validated
public class DictionaryController  {
    @Autowired
    private DictionaryService dictionaryService;

  
    @ApiOperation("字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "codes", required = true, value = "数组"),
    })
    @GetMapping("/select")
    public R select(@NotNull(message = "codes 不予许为空") String[] codes){
       
        return R.ok();
    }

}
相关标签: springboot 校验