diff --git a/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/CodeGenApi.java b/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/CodeGenApi.java new file mode 100644 index 00000000..b6a77556 --- /dev/null +++ b/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/CodeGenApi.java @@ -0,0 +1,34 @@ +package cn.code.nl.module.base.api.codegen; + +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.module.base.api.codegen.dto.CodeGenerateReqDTO; +import cn.code.nl.module.base.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * RPC 服务 - 编码生成 + * + * @author zhouz + */ +@FeignClient(name = ApiConstants.NAME) +@Tag(name = "RPC 服务 - 编码生成") +public interface CodeGenApi { + + String PREFIX = ApiConstants.PREFIX + "/code-gen"; + + /** + * 根据规则编码生成编码字符串 + * + * @param reqDTO 生成请求 + * @return 生成的编码字符串 + */ + @PostMapping(PREFIX + "/generate") + @Operation(summary = "生成编码") + CommonResult generate(@Valid @RequestBody CodeGenerateReqDTO reqDTO); + +} diff --git a/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/dto/CodeGenerateReqDTO.java b/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/dto/CodeGenerateReqDTO.java new file mode 100644 index 00000000..a449edbd --- /dev/null +++ b/nl-module-base/nl-module-base-api/src/main/java/cn/code/nl/module/base/api/codegen/dto/CodeGenerateReqDTO.java @@ -0,0 +1,27 @@ +package cn.code.nl.module.base.api.codegen.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.util.Map; + +/** + * 编码生成请求 DTO + * + * @author zhouz + */ +@Data +public class CodeGenerateReqDTO { + + /** + * 规则编码 + */ + @NotBlank(message = "规则编码不能为空") + private String ruleCode; + + /** + * 业务字段参数(预留,二期 BIZ_FIELD 段使用) + */ + private Map bizParams; + +}