瀏覽代碼

修改生成Uid方法

suntianwu 3 年之前
父節點
當前提交
b6d586aba5
共有 1 個文件被更改,包括 50 次插入0 次删除
  1. 50 0
      src/main/java/com/iden/bms/controller/AutoincrKeyController.java

+ 50 - 0
src/main/java/com/iden/bms/controller/AutoincrKeyController.java

@@ -0,0 +1,50 @@
+package com.iden.bms.controller;
+
+
+import com.iden.common.service.IdenAutoincrKeyService;
+import com.iden.common.util.Result;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+
+/**
+ * @author
+ * @version 1.0.0 创建于 2019-12-04
+ **/
+@RestController
+@Api(value = "AutoincrKeyController", tags = { "存放自增key管理" })
+@Slf4j
+@RequestMapping("/bms/autoincrKey")
+public class AutoincrKeyController {
+
+    @Resource
+    private IdenAutoincrKeyService idenAutoincrKeyService;
+
+
+    @ApiOperation(value = "测试自增key", notes = "测试自增key")
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "header", required = true, name = "token", dataType = "String", value = "token验证信息"),
+            @ApiImplicitParam(paramType = "query", name = "keyFlag", value = "keyFlag"),
+    })
+    @GetMapping(value = "/test", produces = "application/json;charset=utf-8")
+    public Result<Long> test(HttpServletRequest request,
+                             @RequestHeader(name = "token", required = true) String token,
+                             @RequestParam(value = "keyFlag", required = false) String keyFlag) {
+        try {
+            Long maxValue = this.idenAutoincrKeyService.updateMaxValue(keyFlag);
+            return Result.success(maxValue);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error( "测试自增key失败");
+        }
+    }
+
+}