为了直接用Swagger, RequestMapping 要有method = {RequestMethod.POST}
入参是实体还是几个参数,与是否get、post没有关系
get也能实体
@ApiOperation(value = "查询xx")
@GetMapping(value="/list")
public JsonResult list(PageRequest req){
PageUtils pageUtil = ${classname}Service.queryPage(req);
return JsonResult.ok("查询成功!", pageUtil);
}
//甚至 分页参数单独放
public JsonResult<CommonPage<QApplicationRes>> list(QApplicationQueryReq req,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
}
@ApiOperation(value = "查询xx范围")
@GetMapping(value = "/gradeRange")
public JsonResult<List<ParamRes>> gradeList(@RequestParam(value = "leftCode")String leftCode,@RequestParam(value = "rightCode")String rightCode) {
List<EhrOrgGradeEntity> list = ehrOrgGradeService.selectGradeRangeByType(leftCode,rightCode);
@GetMapping(value="/list")
public R list(
@ApiParam(name = "jobNum", value = "工号", type = "query")String jobNum,
String name
){
@GetMapping("/data")
@ApiOperation(value = "获取数据")
public Tablenfo<ActVo> getData(ActQuery query,
PageQuery pageQuery)
{
return taskService.queryListByPage(query, pageQuery);
}
//老土
@RequestMapping(value="/list", method = {RequestMethod.GET})
public R list(@RequestParam Map<String, Object> params){
post也能几个参
这个形式仅限前端通过form-data提交,而无效raw的 json)
@ApiOperation("上传")
@PostMapping("/uploads")
public R uploads(
@ApiParam(name = "file", value = "文件", required = true, type = "form")
@RequestParam("file") MultipartFile file,
@ApiParam(name = "cwId", value = "xxid", type = "query")
@RequestParam(name = "cwId", required = true, defaultValue = "") Integer cwId,
@ApiParam(name = "openId", value = "yyid", type = "query")
@RequestParam(name = "openId", required = true) String openId,
@ApiParam(name = "hrId", value = "推荐人工号", type = "query")
@RequestParam(name = "hrId", required = true) String hrId) {
}
@PostMapping("/uploads")
public R update(@RequestBody ManagementEntity managementEntity){
//老土
@RequestMapping("/update", method = {RequestMethod.POST})
public R update(@RequestBody ManagementEntity managementEntity){
既能又能
@RequestMapping(value = "/hrinfo", method = {RequestMethod.GET,RequestMethod.POST})
public EhrUCRes queryHrinfoByUid(Xx xx) {