feat: 新增编码生成RPC API Controller
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package cn.code.nl.module.base.controller.api;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.module.base.api.codegen.dto.CodeGenerateReqDTO;
|
||||
import cn.code.nl.module.base.service.codegen.CodeGenService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.code.nl.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* RPC API - 编码生成(供其他模块 Feign 调用)
|
||||
*
|
||||
* @author zhouz
|
||||
*/
|
||||
@Tag(name = "RPC API - 编码生成")
|
||||
@RestController
|
||||
@RequestMapping("/rpc-api/base/code-gen")
|
||||
@Validated
|
||||
public class CodeGenController {
|
||||
|
||||
@Resource
|
||||
private CodeGenService codeGenService;
|
||||
|
||||
/**
|
||||
* 生成编码
|
||||
*/
|
||||
@PostMapping("/generate")
|
||||
@Operation(summary = "生成编码")
|
||||
public CommonResult<String> generate(@Valid @RequestBody CodeGenerateReqDTO reqDTO) {
|
||||
String code = codeGenService.generate(reqDTO.getRuleCode());
|
||||
return success(code);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user