20260804223152
This commit is contained in:
1 parent
75b1ccaa6d
commit
7c9761a4fc
71 files changed
+5534
-9113
No files matched your search
@@ -6,9 +6,7 @@ import cn.g3soft.fmsapi.utils.ApiResponse;
|
||||
import cn.g3soft.fmsapi.utils.ParamUtils;
|
||||
import cn.g3soft.fmsapi.utils.snowflake.idgen.IdGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -57,8 +55,12 @@ public class DataController {
|
||||
return ApiResponse.success("保存成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("/nextid")
|
||||
public ApiResponse<?> nextId(@RequestParam(required = false, defaultValue = "1") int count) {
|
||||
@PostMapping("/nextid")
|
||||
public ApiResponse<?> nextId(@RequestBody(required = false) Map<String, Object> params) {
|
||||
int count = 1;
|
||||
if (params != null && params.get("count") instanceof Number num) {
|
||||
count = num.intValue();
|
||||
}
|
||||
if (count <= 1) {
|
||||
return ApiResponse.success(IdGenerator.nextId());
|
||||
}
|
||||
@@ -69,11 +71,14 @@ public class DataController {
|
||||
return ApiResponse.success(ids);
|
||||
}
|
||||
|
||||
@GetMapping("/nextcode")
|
||||
public ApiResponse<?> nextCode(
|
||||
@RequestParam String moduleId,
|
||||
@RequestParam(required = false, defaultValue = "1") int count
|
||||
) throws SQLException {
|
||||
@PostMapping("/nextcode")
|
||||
public ApiResponse<?> nextCode(@RequestBody(required = false) Map<String, Object> params)
|
||||
throws SQLException {
|
||||
String moduleId = ParamUtils.getRequiredString(params, "moduleId");
|
||||
int count = 1;
|
||||
if (params != null && params.get("count") instanceof Number num) {
|
||||
count = num.intValue();
|
||||
}
|
||||
List<String> codes = dataSaveService.nextCode(moduleId, count);
|
||||
if (codes.size() == 1) {
|
||||
return ApiResponse.success(codes.get(0));
|
||||
|
||||
Reference in new issue
Block a user