diff --git a/src/main/java/com/power/doc/controller/enums/EnumNoArgumentController.java b/src/main/java/com/power/doc/controller/enums/EnumNoArgumentController.java new file mode 100644 index 0000000..d90554c --- /dev/null +++ b/src/main/java/com/power/doc/controller/enums/EnumNoArgumentController.java @@ -0,0 +1,124 @@ +package com.power.doc.controller.enums; + +import com.power.common.model.CommonResult; +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; + +/** + * 枚举无参数测试 + * @author Jason Kung + * @date 2024/11/27 11:05 + */ +@RestController +public class EnumNoArgumentController { + + /** + * 测试header参数枚举 + * @param noArgumentEnum 无参数枚举 + * @return 结果 + */ + @GetMapping("/enumNoArgument/testHeaderEnum") + public CommonResult<NoArgumentEnum> testHeaderEnum(@RequestHeader NoArgumentEnum noArgumentEnum) { + return null; + } + + /** + * 测试path参数枚举 + * @param noArgumentEnum 无参数枚举 + * @return 结果 + */ + @GetMapping("/enumNoArgument/testPathEnum/{noArgumentEnum}") + public CommonResult<NoArgumentEnum> testPathEnum(@PathVariable NoArgumentEnum noArgumentEnum) { + return null; + } + + /** + * 测试query参数枚举 + * @param noArgumentEnum 无参数枚举 + * @param noArgumentEnumList 无参数枚举列表 + * @return 结果 + */ + @GetMapping("/enumNoArgument/testQueryEnum") + public CommonResult<NoArgumentEnum> testQueryEnum(@RequestParam NoArgumentEnum noArgumentEnum, + @RequestParam List<NoArgumentEnum> noArgumentEnumList) { + return null; + } + + /** + * 测试post参数枚举 + * @param noArgumentEnum 无参数枚举 + * @param noArgumentEnumList 无参数枚举列表 + * @return 结果 + */ + @PostMapping("/enumNoArgument/testPostEnum") + public CommonResult<NoArgumentEnum> testPostEnum(@RequestParam NoArgumentEnum noArgumentEnum, + @RequestParam List<NoArgumentEnum> noArgumentEnumList) { + return null; + } + + /** + * 测试body参数枚举 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoArgument/testBodyEnum") + public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass) { + return null; + } + + /** + * 测试query+body参数枚举 + * @param noArgumentEnum 无参数枚举参数 + * @param noArgumentEnumList 无参数枚举列表 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoArgument/testQueryAndBodyEnum") + public CommonResult<InnerClass> testQueryAndBodyEnum(@RequestParam NoArgumentEnum noArgumentEnum, + @RequestParam List<NoArgumentEnum> noArgumentEnumList, + @RequestBody InnerClass innerClass) { + return null; + } + + /** + * 内部类 + */ + @Data + public static class InnerClass { + + /** + * 内部参数 + */ + private String innerParam; + /** + * 无参数枚举参数 + */ + private NoArgumentEnum noArgumentEnum; + /** + * 无参数枚举列表 + */ + private List<NoArgumentEnum> noArgumentEnumList; + } + + /** + * 无参数枚举 + * @author jason 2024/11/27. + */ + public enum NoArgumentEnum { + /** + * 内部1 + */ + INNER1, + /** + * 内部2 + */ + INNER2; + } +} diff --git a/src/main/java/com/power/doc/controller/enums/EnumNoDataDictionariesController.java b/src/main/java/com/power/doc/controller/enums/EnumNoDataDictionariesController.java new file mode 100644 index 0000000..036e3c2 --- /dev/null +++ b/src/main/java/com/power/doc/controller/enums/EnumNoDataDictionariesController.java @@ -0,0 +1,143 @@ +package com.power.doc.controller.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.power.common.model.CommonResult; +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; + +/** + * 枚举无数据字典测试 + * @author Jason Kung + * @date 2024/11/27 11:05 + */ +@RestController +public class EnumNoDataDictionariesController { + + /** + * 测试header参数枚举 + * @param noDataDictionariesEnum 无数据字典枚举 + * @return 结果 + */ + @GetMapping("/enumNoDataDictionaries/testHeaderEnum") + public CommonResult<NoDataDictionariesEnum> testHeaderEnum(@RequestHeader NoDataDictionariesEnum noDataDictionariesEnum) { + return null; + } + + /** + * 测试path参数枚举 + * @param noDataDictionariesEnum 无数据字典枚举 + * @return 结果 + */ + @GetMapping("/enumNoDataDictionaries/testPathEnum/{noDataDictionariesEnum}") + public CommonResult<NoDataDictionariesEnum> testPathEnum(@PathVariable NoDataDictionariesEnum noDataDictionariesEnum) { + return null; + } + + /** + * 测试query参数枚举 + * @param noDataDictionariesEnum 无数据字典枚举 + * @param noDataDictionariesEnumList 无数据字典枚举列表 + * @return 结果 + */ + @GetMapping("/enumNoDataDictionaries/testQueryEnum") + public CommonResult<NoDataDictionariesEnum> testQueryEnum(@RequestParam NoDataDictionariesEnum noDataDictionariesEnum, + @RequestParam List<NoDataDictionariesEnum> noDataDictionariesEnumList) { + return null; + } + + /** + * 测试post参数枚举 + * @param noDataDictionariesEnum 无数据字典枚举 + * @param noDataDictionariesEnumList 无数据字典枚举列表 + * @return 结果 + */ + @PostMapping("/enumNoDataDictionaries/testPostEnum") + public CommonResult<NoDataDictionariesEnum> testPostEnum(@RequestParam NoDataDictionariesEnum noDataDictionariesEnum, + @RequestParam List<NoDataDictionariesEnum> noDataDictionariesEnumList) { + return null; + } + + /** + * 测试body参数枚举 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoDataDictionaries/testBodyEnum") + public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass) { + return null; + } + + /** + * 测试query+body参数枚举 + * @param noDataDictionariesEnum 无数据字典枚举参数 + * @param noDataDictionariesEnumList 无数据字典枚举列表 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoDataDictionaries/testQueryAndBodyEnum") + public CommonResult<InnerClass> testQueryAndBodyEnum(@RequestParam NoDataDictionariesEnum noDataDictionariesEnum, + @RequestParam List<NoDataDictionariesEnum> noDataDictionariesEnumList, + @RequestBody InnerClass innerClass) { + return null; + } + + /** + * 内部类 + */ + @Data + public static class InnerClass { + + /** + * 内部参数 + */ + private String innerParam; + /** + * 无数据字典枚举参数 + */ + private NoDataDictionariesEnum noDataDictionariesEnum; + /** + * 无数据字典枚举列表 + */ + private List<NoDataDictionariesEnum> noDataDictionariesEnumList; + } + + /** + * 无数据字典枚举 + * @author jason 2024/11/27. + */ + public enum NoDataDictionariesEnum { + /** + * 内部1 + */ + INNER1(1, "内部1"), + /** + * 内部2 + */ + INNER2(2, "内部2"); + + private int id; + + private String text; + + NoDataDictionariesEnum(int id, String text) { + this.id = id; + this.text = text; + } + + @JsonValue + public Integer getId() { + return this.id; + } + + public String getText() { + return text; + } + } +} diff --git a/src/main/java/com/power/doc/controller/enums/EnumNoJsonValueController.java b/src/main/java/com/power/doc/controller/enums/EnumNoJsonValueController.java new file mode 100644 index 0000000..158f529 --- /dev/null +++ b/src/main/java/com/power/doc/controller/enums/EnumNoJsonValueController.java @@ -0,0 +1,141 @@ +package com.power.doc.controller.enums; + +import com.power.common.model.CommonResult; +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; + +/** + * 枚举无JsonValue参数测试 + * @author Jason Kung + * @date 2024/11/27 11:05 + */ +@RestController +public class EnumNoJsonValueController { + + /** + * 测试header参数枚举 + * @param noJsonValueEnum 无JsonValue枚举 + * @return 结果 + */ + @GetMapping("/enumNoJsonValue/testHeaderEnum") + public CommonResult<NoJsonValueEnum> testHeaderEnum(@RequestHeader NoJsonValueEnum noJsonValueEnum) { + return null; + } + + /** + * 测试path参数枚举 + * @param noJsonValueEnum 无JsonValue枚举 + * @return 结果 + */ + @GetMapping("/enumNoJsonValue/testPathEnum/{noJsonValueEnum}") + public CommonResult<NoJsonValueEnum> testPathEnum(@PathVariable NoJsonValueEnum noJsonValueEnum) { + return null; + } + + /** + * 测试query参数枚举 + * @param noJsonValueEnum 无JsonValue枚举 + * @param noJsonValueEnumList 无JsonValue枚举列表 + * @return 结果 + */ + @GetMapping("/enumNoJsonValue/testQueryEnum") + public CommonResult<NoJsonValueEnum> testQueryEnum(@RequestParam NoJsonValueEnum noJsonValueEnum, + @RequestParam List<NoJsonValueEnum> noJsonValueEnumList) { + return null; + } + + /** + * 测试post参数枚举 + * @param noJsonValueEnum 无JsonValue枚举 + * @param noJsonValueEnumList 无JsonValue枚举列表 + * @return 结果 + */ + @PostMapping("/enumNoJsonValue/testPostEnum") + public CommonResult<NoJsonValueEnum> testPostEnum(@RequestParam NoJsonValueEnum noJsonValueEnum, + @RequestParam List<NoJsonValueEnum> noJsonValueEnumList) { + return null; + } + + /** + * 测试body参数枚举 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoJsonValue/testBodyEnum") + public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass) { + return null; + } + + /** + * 测试query+body参数枚举 + * @param noJsonValueEnum 无JsonValue枚举参数 + * @param noJsonValueEnumList 无JsonValue枚举列表 + * @param innerClass 内部类 + * @return 结果 + */ + @PostMapping("/enumNoJsonValue/testQueryAndBodyEnum") + public CommonResult<InnerClass> testQueryAndBodyEnum(@RequestParam NoJsonValueEnum noJsonValueEnum, + @RequestParam List<NoJsonValueEnum> noJsonValueEnumList, + @RequestBody InnerClass innerClass) { + return null; + } + + /** + * 内部类 + */ + @Data + public static class InnerClass { + + /** + * 内部参数 + */ + private String innerParam; + /** + * 无JsonValue枚举参数 + */ + private NoJsonValueEnum noJsonValueEnum; + /** + * 无JsonValue枚举列表 + */ + private List<NoJsonValueEnum> noJsonValueEnumList; + } + + /** + * 无JsonValue枚举 + * @author jason 2024/11/27. + */ + public enum NoJsonValueEnum { + /** + * 内部1 + */ + INNER1(1, "内部1"), + /** + * 内部2 + */ + INNER2(2, "内部2"); + + private int id; + + private String text; + + NoJsonValueEnum(int id, String text) { + this.id = id; + this.text = text; + } + + public Integer getId() { + return this.id; + } + + public String getText() { + return text; + } + } +}