Skip to content

Commit

Permalink
Merge pull request #96 from jasonkung22/feat_map_enum
Browse files Browse the repository at this point in the history
test(enum): Added the test example when Map key is enum
  • Loading branch information
shalousun authored Dec 19, 2024
2 parents eefcfb0 + f482909 commit 21de420
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.power.common.model.CommonResult;
import java.util.List;
import java.util.Map;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -73,6 +74,16 @@ public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass)
return null;
}

/**
* 测试body map参数枚举
* @param map 集合
* @return 结果
*/
@PostMapping("/enumNoArgument/testBodyMapEnum")
public CommonResult<Map<NoArgumentEnum, InnerClass>> testBodyEnum(@RequestBody Map<NoArgumentEnum, InnerClass> map) {
return CommonResult.ok(map);
}

/**
* 测试query+body参数枚举
* @param noArgumentEnum 无参数枚举参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonValue;
import com.power.common.model.CommonResult;
import java.util.List;
import java.util.Map;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -74,6 +75,16 @@ public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass)
return null;
}

/**
* 测试body map参数枚举
* @param map 集合
* @return 结果
*/
@PostMapping("/enumNoDataDictionaries/testBodyMapEnum")
public CommonResult<Map<NoDataDictionariesEnum, InnerClass>> testBodyEnum(@RequestBody Map<NoDataDictionariesEnum, InnerClass> map) {
return CommonResult.ok(map);
}

/**
* 测试query+body参数枚举
* @param noDataDictionariesEnum 无数据字典枚举参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.power.common.model.CommonResult;
import java.util.List;
import java.util.Map;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -73,6 +74,16 @@ public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass)
return null;
}

/**
* 测试body map参数枚举
* @param map 集合
* @return 结果
*/
@PostMapping("/enumNoJsonValue/testBodyMapEnum")
public CommonResult<Map<NoJsonValueEnum, InnerClass>> testBodyEnum(@RequestBody Map<NoJsonValueEnum, InnerClass> map) {
return CommonResult.ok(map);
}

/**
* 测试query+body参数枚举
* @param noJsonValueEnum 无JsonValue枚举参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.power.common.model.CommonResult;
import com.power.doc.enums.IEnum;
import java.util.List;
import java.util.Map;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -75,6 +76,16 @@ public CommonResult<InnerClass> testBodyEnum(@RequestBody InnerClass innerClass)
return null;
}

/**
* 测试body map参数枚举
* @param map 集合
* @return 结果
*/
@PostMapping("/innerEnum/testBodyMapEnum")
public CommonResult<Map<InnerEnum, InnerClass>> testBodyEnum(@RequestBody Map<InnerEnum, InnerClass> map) {
return CommonResult.ok(map);
}

/**
* 测试query+body参数枚举
* @param innerEnum 内部枚举参数
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/smart-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@
},{
"name": "Map测试",
"apis": "com.power.doc.controller.map.*"
},{
"name": "Enum测试",
"apis": "com.power.doc.controller.enums.*"
}
],
"revisionLogs": [
Expand Down

0 comments on commit 21de420

Please sign in to comment.