|
@@ -0,0 +1,50 @@
|
|
|
+package com.txz.mall.controller;
|
|
|
+
|
|
|
+import com.txz.mall.core.Result;
|
|
|
+import com.txz.mall.enums.OrderStatusEnum;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import vo.EnumBo;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by CodeGenerator on 2025/07/11.
|
|
|
+ */
|
|
|
+@Api(tags = "[APP]通用管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/common")
|
|
|
+public class CommonController {
|
|
|
+
|
|
|
+ private static Logger log = LoggerFactory.getLogger(CommonController.class);
|
|
|
+
|
|
|
+ @ApiOperation(value = "枚举 1-订单状态")
|
|
|
+ @PostMapping(value = "/getEnum")
|
|
|
+ public Result getEnum(@RequestParam Integer id) {
|
|
|
+ if (id == null) {
|
|
|
+ id = 1;
|
|
|
+ }
|
|
|
+ List<EnumBo> list = new ArrayList<>();
|
|
|
+ switch (id) {
|
|
|
+ case 1:
|
|
|
+ // 把枚举转成list
|
|
|
+ list = Arrays.stream(OrderStatusEnum.values())
|
|
|
+ .map(temp -> EnumBo.builder().code(temp.getKey()).name(temp.getValue()).build()).collect(Collectors.toList());
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return Result.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|