Skip to content

Commit

Permalink
Merge pull request #88 from jasonkung22/feat/improve_inner_enum_example
Browse files Browse the repository at this point in the history
perf(inner enum): improve inner enum example
  • Loading branch information
shalousun authored Dec 3, 2024
2 parents 84dcc2b + 2151648 commit 232e257
Showing 1 changed file with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -2,17 +2,14 @@

import com.fasterxml.jackson.annotation.JsonValue;
import com.power.common.model.CommonResult;
import com.power.doc.entity.Order;
import com.power.doc.enums.GenderEnum;
import com.power.doc.enums.IEnum;
import com.power.doc.enums.OrderEnum;
import com.power.doc.enums.SimpleEnum;
import java.util.List;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@@ -24,23 +21,47 @@
@RestController
public class InnerEnumController {

/**
* 测试header参数枚举
* @param innerEnum 内部枚举
* @return 结果
*/
@GetMapping("/innerEnum/testHeaderEnum")
public CommonResult<InnerEnum> testHeaderEnum(@RequestHeader InnerEnum innerEnum) {
return null;
}

/**
* 测试path参数枚举
* @param innerEnum 内部枚举
* @return 结果
*/
@GetMapping("/innerEnum/testPathEnum/{innerEnum}")
public CommonResult<InnerEnum> testPathEnum(@PathVariable InnerEnum innerEnum) {
return null;
}

/**
* 测试query参数枚举
* @param innerEnum 内部枚举
* @param innerEnum 内部枚举
* @param innerEnumList 内部枚举列表
* @return 结果
*/
@GetMapping("/innerEnum/testQueryEnum")
public CommonResult<InnerEnum> testQueryEnum(@RequestParam InnerEnum innerEnum) {
public CommonResult<InnerEnum> testQueryEnum(@RequestParam InnerEnum innerEnum,
@RequestParam List<InnerEnum> innerEnumList) {
return null;
}

/**
* 测试post参数枚举
* @param innerEnum 内部枚举
* 测试post方法query参数枚举
* @param innerEnum 内部枚举
* @param innerEnumList 内部枚举列表
* @return 结果
*/
@PostMapping("/innerEnum/testPostEnum")
public CommonResult<InnerEnum> testPostEnum(@RequestParam InnerEnum innerEnum) {
public CommonResult<InnerEnum> testPostEnum(@RequestParam InnerEnum innerEnum,
@RequestParam List<InnerEnum> innerEnumList) {
return null;
}

@@ -56,12 +77,14 @@ public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass)

/**
* 测试query+body参数枚举
* @param innerEnum 内部枚举参数
* @param innerClass 内部类
* @param innerEnum 内部枚举参数
* @param innerEnumList 内部枚举列表
* @param innerClass 内部类
* @return 结果
*/
@PostMapping("/innerEnum/testBodyEnum")
@PostMapping("/innerEnum/testQueryAndBodyEnum")
public CommonResult<InnerClass> testQueryAndBodyEnum(@RequestParam InnerEnum innerEnum,
@RequestParam List<InnerEnum> innerEnumList,
@RequestBody InnerClass innerClass) {
return null;
}
@@ -80,6 +103,10 @@ public static class InnerClass {
* 内部枚举参数
*/
private InnerEnum innerEnum;
/**
* 内部枚举列表
*/
private List<InnerEnum> innerEnumList;
}

/**

0 comments on commit 232e257

Please sign in to comment.