Commit 40d40a63 authored by KeYong's avatar KeYong

提交脚本执行后端逻辑

parent b145a12a
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -4,6 +4,7 @@ import org.slf4j.Logger; ...@@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
...@@ -25,7 +26,7 @@ import java.net.UnknownHostException; ...@@ -25,7 +26,7 @@ import java.net.UnknownHostException;
* @author amos * @author amos
* @version $Id: AmosBootUtilsAdpterApplication, v 0.1 2024年5月7日 下午4:56:29 amos Exp $ * @version $Id: AmosBootUtilsAdpterApplication, v 0.1 2024年5月7日 下午4:56:29 amos Exp $
*/ */
@SpringBootApplication @SpringBootApplication(exclude=DataSourceAutoConfiguration.class)
@EnableConfigurationProperties @EnableConfigurationProperties
@ServletComponentScan @ServletComponentScan
@EnableDiscoveryClient @EnableDiscoveryClient
......
package com.yeejoin.amos.adpter.controller; package com.yeejoin.amos.adpter.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.adpter.service.AdpterService; import com.yeejoin.amos.adpter.service.AdpterService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
...@@ -41,4 +43,17 @@ public class AdpterController { ...@@ -41,4 +43,17 @@ public class AdpterController {
return handle; return handle;
} }
/**
* 数据库脚本执行Api
*
* @return
*/
@PostMapping(value = "/execute/file")
@ApiOperation(httpMethod = "POST", value = "脚本执行接口Api", notes = "脚本执行接口Api")
public void executeSqlFile(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "dbHost") String dbHost, @RequestParam(value = "port") String port,
@RequestParam(value = "dbName") String dbName, @RequestParam(value = "userName") String userName,
@RequestParam(value = "dbPwd") String dbPwd, @RequestPart(value = "file") MultipartFile file) throws UnsupportedEncodingException {
adpterService.executeSqlFile(request, response, dbHost, port, dbName, userName, dbPwd, file);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment