代码生成
This commit is contained in:
@@ -2,6 +2,8 @@ package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.domain.template.CodeGen;
|
||||
import com.cczsa.xinghe.codegen.service.CodeGenService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @date 2026/1/10
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Tag(name = "代码生成")
|
||||
@RestController
|
||||
@RequestMapping("/codegen")
|
||||
@RequiredArgsConstructor
|
||||
@@ -24,6 +27,7 @@ public class CodeGenController {
|
||||
|
||||
private final CodeGenService codeGenService;
|
||||
|
||||
@Operation(summary = "下载代码")
|
||||
@PostMapping("/download")
|
||||
public ResponseEntity<byte[]> downloadCode(@RequestBody @Valid CodeGen req) {
|
||||
try {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@@ -103,4 +104,20 @@ public class FunOperationSaveUpdateReq implements Serializable {
|
||||
@Schema(description = "路径参数")
|
||||
private String pathParams;
|
||||
|
||||
@AssertTrue(message = "当不需要响应参数时,也不能分页")
|
||||
public boolean isValidPageAndResParams() {
|
||||
if (Boolean.FALSE.equals(isResParams)) {
|
||||
return Boolean.FALSE.equals(isPage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "当需要请求参数时,路径参数必须为空")
|
||||
public boolean isValidReqParamsAndPathParams() {
|
||||
if (Boolean.TRUE.equals(isReqParams)) {
|
||||
return pathParams == null || pathParams.isEmpty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class FunOperationServiceImpl implements FunOperationService {
|
||||
.like(FunOperationEntity::getFunName, req.getFunName(), StrUtil.isNotBlank(req.getFunName()))
|
||||
.eq(FunItemEntity::getIsTenant, isTenant, isTenantNotNull)
|
||||
.eq(FunOperationEntity::getIsGreenLight,false,isTenantNotNull) // 直接放行,不用提供绑定
|
||||
.orderBy(FunOperationEntity::getId, true)
|
||||
.orderBy(FunOperationEntity::getSortOrder, false);
|
||||
List<FunOperationQueryRes> funOperationQueryRes = funOperationMapper.selectListByQueryAs(queryWrapper, FunOperationQueryRes.class);
|
||||
return XResult.ok(funOperationQueryRes);
|
||||
|
||||
Reference in New Issue
Block a user