Kaynağa Gözat

代码生成接口调整

hubin 8 ay önce
ebeveyn
işleme
1a08c86ac8

+ 3 - 2
src/main/java/com/aizuda/boot/modules/gen/controller/GenTableController.java

@@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.AllArgsConstructor;
 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;
 
@@ -31,14 +32,14 @@ public class GenTableController extends ApiController {
     @Operation(summary = "预览")
     @Permission("gen:table:preview")
     @PostMapping("/preview")
-    public List<GenVO> preview(@Validated GenDTO dto) {
+    public List<GenVO> preview(@Validated @RequestBody GenDTO dto) {
         return genTableService.preview(dto);
     }
 
     @Operation(summary = "下载")
     @Permission("gen:table:download")
     @PostMapping("/download")
-    public void download(@Validated GenDTO dto) {
+    public void download(@Validated @RequestBody GenDTO dto) {
         genTableService.download(response, dto);
     }
 

+ 1 - 1
src/main/java/com/aizuda/boot/modules/gen/service/impl/GenTableServiceImpl.java

@@ -126,7 +126,7 @@ public class GenTableServiceImpl implements IGenTableService {
 
     private ConfigBuilder buildConfigBuilder(GenDTO dto) {
         DataSourceConfig.Builder dataSource;
-        if (null != dto.getDatabaseId()) {
+        if (null != dto.getDatabaseId() && dto.getDatabaseId() > 0) {
             GenDatabase gb = genDatabaseService.checkById(dto.getDatabaseId());
             dataSource = new DataSourceConfig.Builder(gb.url(), gb.getUsername(), gb.getPassword());
         } else {