Merge remote-tracking branch 'origin/dev' into dev
commit
e969999ed8
2
pom.xml
2
pom.xml
|
@ -24,7 +24,7 @@
|
||||||
<module>srt-cloud-gateway</module>
|
<module>srt-cloud-gateway</module>
|
||||||
<module>srt-data-development</module>
|
<module>srt-data-development</module>
|
||||||
<module>srt-cloud-data-governance</module>
|
<module>srt-cloud-data-governance</module>
|
||||||
<module>srt-cloud-data-service</module>
|
<module>srt-cloud-data-server</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,204 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>srt-cloud-data-server</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud-api</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!--使用log42j-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud-mybatis</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud-dbswitch</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>jsqlparser</artifactId>
|
||||||
|
<groupId>com.github.jsqlparser</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- <finalName>${project.artifactId}</finalName>-->
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>appassembler-maven-plugin</artifactId>
|
||||||
|
<version>2.1.0</version>
|
||||||
|
<!-- 如果不配置 generate-daemons,则打包命令为 mvn clean package appassembler:assemble -->
|
||||||
|
<!-- 如果配置了 generate-daemons,打包命令可以是 mvn clean package 也可以是 mvn clean package appassembler:assemble -->
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate-jsw-scripts</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>generate-daemons</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<!-- flat与lib共同决定将项目用的的所有jar包复制到lib目录下 -->
|
||||||
|
<repositoryLayout>flat</repositoryLayout>
|
||||||
|
<!--从哪里copy配置文件-->
|
||||||
|
<configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
|
||||||
|
<includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
|
||||||
|
<!--是否copy配置文件-->
|
||||||
|
<copyConfigurationDirectory>true</copyConfigurationDirectory>
|
||||||
|
<!--配置文件存放在conf目录路径-->
|
||||||
|
<configurationDirectory>conf</configurationDirectory>
|
||||||
|
<!-- 打包的jar,以及maven依赖的jar放到这个目录里面 -->
|
||||||
|
<repositoryName>lib</repositoryName>
|
||||||
|
<!-- 可执行脚本的目录 -->
|
||||||
|
<binFolder>bin</binFolder>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<logsDirectory>logs</logsDirectory>
|
||||||
|
|
||||||
|
<daemons>
|
||||||
|
<daemon>
|
||||||
|
<id>${project.artifactId}</id>
|
||||||
|
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||||
|
<platforms>
|
||||||
|
<platform>jsw</platform>
|
||||||
|
</platforms>
|
||||||
|
<generatorConfigurations>
|
||||||
|
<generatorConfiguration>
|
||||||
|
<generator>jsw</generator>
|
||||||
|
<includes>
|
||||||
|
<include>linux-x86-32</include>
|
||||||
|
<include>linux-x86-64</include>
|
||||||
|
<include>windows-x86-32</include>
|
||||||
|
<include>windows-x86-64</include>
|
||||||
|
</includes>
|
||||||
|
<configuration>
|
||||||
|
<property>
|
||||||
|
<name>configuration.directory.in.classpath.first</name>
|
||||||
|
<value>conf</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>wrapper.ping.timeout</name>
|
||||||
|
<value>120</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>set.default.REPO_DIR</name>
|
||||||
|
<value>lib</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>wrapper.logfile</name>
|
||||||
|
<value>logs/wrapper.log</value>
|
||||||
|
</property>
|
||||||
|
</configuration>
|
||||||
|
</generatorConfiguration>
|
||||||
|
</generatorConfigurations>
|
||||||
|
<jvmSettings>
|
||||||
|
<!-- jvm参数 -->
|
||||||
|
<!--<systemProperties>
|
||||||
|
<systemProperty>com.sun.management.jmxremote</systemProperty>
|
||||||
|
<systemProperty>com.sun.management.jmxremote.port=1984</systemProperty>
|
||||||
|
<systemProperty>com.sun.management.jmxremote.authenticate=false</systemProperty>
|
||||||
|
<systemProperty>com.sun.management.jmxremote.ssl=false</systemProperty>
|
||||||
|
</systemProperties>-->
|
||||||
|
<extraArguments>
|
||||||
|
<extraArgument>-server</extraArgument>
|
||||||
|
<extraArgument>-Dfile.encoding=utf-8</extraArgument>
|
||||||
|
<extraArgument>-Xms128m</extraArgument>
|
||||||
|
<extraArgument>-Xmx1024m</extraArgument>
|
||||||
|
<extraArgument>-XX:+PrintGCDetails</extraArgument><!--输出GC的详细日志-->
|
||||||
|
<extraArgument>-XX:+PrintGCDateStamps</extraArgument><!--输出GC的时间戳-->
|
||||||
|
<extraArgument>-Xloggc:logs/gc.log</extraArgument><!--日志文件的输出路径-->
|
||||||
|
</extraArguments>
|
||||||
|
</jvmSettings>
|
||||||
|
</daemon>
|
||||||
|
</daemons>
|
||||||
|
<programs>
|
||||||
|
<program>
|
||||||
|
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||||
|
<id>${project.artifactId}</id>
|
||||||
|
</program>
|
||||||
|
</programs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!--打包 日常调试打包可以把该组件注释掉,不然install的速度比较慢-->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>${project.parent.basedir}/assembly/assembly-win.xml</descriptor>
|
||||||
|
<descriptor>${project.parent.basedir}/assembly/assembly-linux.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!--<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package net.srt;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
|
@EnableFeignClients
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DataServiceApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DataServiceApplication.class, args);
|
||||||
|
System.out.println("==============启动成功===================");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.dto.ApiConfigDto;
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.query.ApiConfigQuery;
|
||||||
|
import net.srt.service.ApiConfigService;
|
||||||
|
import net.srt.vo.ApiConfig;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api-config")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiConfigController {
|
||||||
|
|
||||||
|
private final ApiConfigService apiConfigService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文件分组树
|
||||||
|
*
|
||||||
|
* @return 结果列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/api-group")
|
||||||
|
@Operation(summary = "查询文件分组树")
|
||||||
|
public Result<List<TreeNodeVo>> listTree() {
|
||||||
|
return Result.ok(apiConfigService.listTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询API配置
|
||||||
|
* @param query API配置查询对象
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "分页")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||||
|
public Result<PageResult<ApiConfig>> page(@Valid ApiConfigQuery query) {
|
||||||
|
PageResult<ApiConfig> page = apiConfigService.page(query);
|
||||||
|
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取IP和端口信息
|
||||||
|
*
|
||||||
|
* @return 返回IP和端口信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getIpPort")
|
||||||
|
public Result<String> getIpPort() {
|
||||||
|
return Result.ok(apiConfigService.getIpPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取API配置信息
|
||||||
|
*
|
||||||
|
* @param id API配置ID
|
||||||
|
* @return API配置实体对象
|
||||||
|
*/
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@Operation(summary = "查看")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:info')")
|
||||||
|
public Result<ApiConfigEntity> get(@PathVariable("id") Long id) {
|
||||||
|
ApiConfigEntity apiConfig = apiConfigService.getByI(id);
|
||||||
|
|
||||||
|
return Result.ok(apiConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||||
|
public Result<ApiConfigEntity> update(@PathVariable Long id, @RequestBody @Valid ApiConfigEntity vo) {
|
||||||
|
apiConfigService.update(id,vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
@PutMapping("/{id}/offline")
|
||||||
|
@Operation(summary = "下线")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||||
|
public Result<ApiConfigEntity> xia(@PathVariable Long id) {
|
||||||
|
apiConfigService.xia(id);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}/online")
|
||||||
|
@Operation(summary = "上线")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||||
|
public Result<ApiConfigEntity> shang(@PathVariable Long id) {
|
||||||
|
apiConfigService.shang(id);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "新增")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:save')")
|
||||||
|
public Result<String> insert(@RequestBody ApiConfig vo) {
|
||||||
|
apiConfigService.sav(vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:delete')")
|
||||||
|
public Result<String> delete(@RequestBody List<Long> idList) {
|
||||||
|
apiConfigService.removeByI(idList);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.ApiGroupConvert;
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.service.ApiGroupService;
|
||||||
|
import net.srt.vo.ApiGroup;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据服务-api分组
|
||||||
|
*
|
||||||
|
* @author zrx 985134801@qq.com
|
||||||
|
* @since 1.0.0 2023-01-28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api-group")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiGroupController {
|
||||||
|
private final ApiGroupService apiGroupService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "查询文件分组树")
|
||||||
|
public Result<List<TreeNodeVo>> listTree() {
|
||||||
|
return Result.ok(apiGroupService.listTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@Operation(summary = "信息")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-group:info')")
|
||||||
|
public Result<ApiGroup> get(@PathVariable("id") Long id){
|
||||||
|
ApiGroupEntity entity = apiGroupService.getById(id);
|
||||||
|
return Result.ok(ApiGroupConvert.INSTANCE.convert(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "保存")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-group:save')")
|
||||||
|
public Result<String> save(@RequestBody ApiGroup vo) {
|
||||||
|
apiGroupService.save(vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-group:update')")
|
||||||
|
public Result<String> update(@RequestBody @Valid ApiGroup vo) {
|
||||||
|
apiGroupService.update(vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-group:delete')")
|
||||||
|
public Result<String> delete(@PathVariable Long id) {
|
||||||
|
apiGroupService.delete(id);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.query.ApiConfigQuery;
|
||||||
|
import net.srt.query.ApiLogQuery;
|
||||||
|
import net.srt.service.ApiLogService;
|
||||||
|
import net.srt.vo.ApiConfig;
|
||||||
|
import net.srt.vo.ApiLog;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiTest
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/log")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ApiLogService apiLogService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "日志列表")
|
||||||
|
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||||
|
public Result<PageResult<ApiLog>> page(@Valid ApiLogQuery query) {
|
||||||
|
PageResult<ApiLog> page = apiLogService.pag(query);
|
||||||
|
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.dto.ApiConfigDto;
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.vo.ApiConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据服务-api配置
|
||||||
|
*
|
||||||
|
* @author zrx 985134801@qq.com
|
||||||
|
* @since 1.0.0 2023-01-28
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ApiConfigConvert {
|
||||||
|
ApiConfigConvert INSTANCE = Mappers.getMapper(ApiConfigConvert.class);
|
||||||
|
|
||||||
|
ApiConfigEntity convert(ApiConfig vo);
|
||||||
|
|
||||||
|
ApiConfig convert(ApiConfigEntity entity);
|
||||||
|
|
||||||
|
ApiConfigDto convertDto(ApiConfigEntity entity);
|
||||||
|
|
||||||
|
List<ApiConfig> convertList(List<ApiConfigEntity> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.vo.ApiGroup;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据服务-api分组
|
||||||
|
*
|
||||||
|
* @author zrx 985134801@qq.com
|
||||||
|
* @since 1.0.0 2023-01-28
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ApiGroupConvert {
|
||||||
|
ApiGroupConvert INSTANCE = Mappers.getMapper(ApiGroupConvert.class);
|
||||||
|
|
||||||
|
ApiGroupEntity convert(ApiGroup vo);
|
||||||
|
|
||||||
|
ApiGroup convert(ApiGroupEntity entity);
|
||||||
|
|
||||||
|
List<ApiGroup> convertList(List<ApiGroupEntity> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiLogEntity;
|
||||||
|
import net.srt.vo.ApiLog;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogConvert
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ApiLogConvert {
|
||||||
|
|
||||||
|
ApiLogConvert INSTANCE = Mappers.getMapper(ApiLogConvert.class);
|
||||||
|
|
||||||
|
ApiLogEntity convert(ApiLog vo);
|
||||||
|
|
||||||
|
ApiLog convert(ApiLogEntity entity);
|
||||||
|
|
||||||
|
List<ApiLog> convertList(List<ApiLogEntity> list);
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package net.srt.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApiConfigDto implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
private Long groupId;
|
||||||
|
private String path;
|
||||||
|
private String type;
|
||||||
|
private String name;
|
||||||
|
private String note;
|
||||||
|
private String sqlText;
|
||||||
|
private String sqlSeparator;
|
||||||
|
private Integer sqlMaxRow;
|
||||||
|
private String sqlParam;
|
||||||
|
private String jsonParam;
|
||||||
|
private String responseResult;
|
||||||
|
private String contentType;
|
||||||
|
private Integer status;
|
||||||
|
private Date releaseTime;
|
||||||
|
private Long releaseUserId;
|
||||||
|
private Integer sqlDbType;
|
||||||
|
private Long databaseId;
|
||||||
|
private Integer previlege;
|
||||||
|
private Integer openTrans;
|
||||||
|
private Long projectId;
|
||||||
|
private Integer version;
|
||||||
|
private Integer deleted;
|
||||||
|
private Long creator;
|
||||||
|
private Date createTime;
|
||||||
|
private Long updater;
|
||||||
|
private Date updateTime;
|
||||||
|
private Integer requestedTimes;
|
||||||
|
private Integer requestedSuccessTimes;
|
||||||
|
private Integer requestedFailedTimes;
|
||||||
|
private Long authId;
|
||||||
|
private String group;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("data_dispatch_catalogue")
|
||||||
|
public class ApiConfigEntity extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 父级id(顶级为0)
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组序号
|
||||||
|
*/
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组路径
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// 私有属性,状态
|
||||||
|
private Integer status;
|
||||||
|
// 私有属性,发布用户ID
|
||||||
|
private Long releaseUserId;
|
||||||
|
// 自定义注解,日期格式化,格式为"yyyy-MM-dd HH:mm:ss"
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date releaseTime;
|
||||||
|
// 私有属性,内容类型
|
||||||
|
private String contentType;
|
||||||
|
private Integer previlege;
|
||||||
|
private Integer openTrans;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "data_dispatch_catalogue",autoResultMap = true)
|
||||||
|
public class ApiGroupEntity extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 父级id(顶级为0)
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组序号
|
||||||
|
*/
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组路径
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogEntity
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "data_service_api_log",autoResultMap = true)
|
||||||
|
public class ApiLogEntity extends BaseEntity {
|
||||||
|
// private Integer id;
|
||||||
|
private String url;
|
||||||
|
private Integer duration;
|
||||||
|
private String ip;
|
||||||
|
private Integer apiId;
|
||||||
|
private String error;
|
||||||
|
private Integer projectId;
|
||||||
|
// private String deleted;
|
||||||
|
// private Integer creator;
|
||||||
|
// private String createTime;
|
||||||
|
// private Integer updater;
|
||||||
|
private Date updateTime;
|
||||||
|
private String apiName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.srt.mapper;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ApiConfigDao extends BaseDao<ApiConfigEntity> {
|
||||||
|
void xia(@Param("id") Long id);
|
||||||
|
|
||||||
|
void shang(@Param("id") Long id);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package net.srt.mapper;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ApiGroupDao extends BaseDao<ApiGroupEntity> {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package net.srt.mapper;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.entity.ApiLogEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogDao
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ApiLogDao extends BaseDao<ApiLogEntity> {
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.srt.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.common.query.Query;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApiConfigQuery extends Query {
|
||||||
|
|
||||||
|
private Long groupId;
|
||||||
|
private Long resourceId;
|
||||||
|
private Long appId;
|
||||||
|
private String name;
|
||||||
|
private String path;
|
||||||
|
private String contentType;
|
||||||
|
private Integer status;
|
||||||
|
private Integer sqlDbType;
|
||||||
|
private Long databaseId;
|
||||||
|
private Integer privates;
|
||||||
|
private Integer openTrans;
|
||||||
|
private Integer queryApply;
|
||||||
|
private Integer ifMarket;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package net.srt.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.common.query.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogQuery
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ApiLogQuery extends Query {
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
private String apiName;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.dto.ApiConfigDto;
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.query.ApiConfigQuery;
|
||||||
|
import net.srt.vo.ApiConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ApiConfigService extends BaseService<ApiConfigEntity> {
|
||||||
|
String getIpPort();
|
||||||
|
|
||||||
|
List<TreeNodeVo> listTree();
|
||||||
|
|
||||||
|
|
||||||
|
PageResult<ApiConfig> page(ApiConfigQuery query);
|
||||||
|
|
||||||
|
ApiConfigEntity getByI(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
void update(Long id, ApiConfigEntity vo);
|
||||||
|
|
||||||
|
void xia(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
void shang(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void sav(ApiConfig vo);
|
||||||
|
|
||||||
|
void removeByI(List<Long> idList);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.vo.ApiGroup;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ApiGroupService extends BaseService<ApiGroupEntity> {
|
||||||
|
List<TreeNodeVo> listTree();
|
||||||
|
|
||||||
|
void save(ApiGroup vo);
|
||||||
|
|
||||||
|
void update(ApiGroup vo);
|
||||||
|
|
||||||
|
void delete(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.entity.ApiLogEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.query.ApiLogQuery;
|
||||||
|
import net.srt.vo.ApiLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogService
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
public interface ApiLogService extends BaseService<ApiLogEntity> {
|
||||||
|
|
||||||
|
PageResult<ApiLog> pag(ApiLogQuery query);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.ApiConfigConvert;
|
||||||
|
import net.srt.convert.ApiGroupConvert;
|
||||||
|
import net.srt.dto.ApiConfigDto;
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.BeanUtil;
|
||||||
|
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.mapper.ApiConfigDao;
|
||||||
|
import net.srt.query.ApiConfigQuery;
|
||||||
|
import net.srt.service.ApiConfigService;
|
||||||
|
import net.srt.vo.ApiConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfigEntity> implements ApiConfigService {
|
||||||
|
@Override
|
||||||
|
public String getIpPort() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从数据库中查询并返回树结构的节点列表
|
||||||
|
* @return List<TreeNodeVo> 树节点列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listTree() {
|
||||||
|
// 创建查询条件
|
||||||
|
LambdaQueryWrapper<ApiConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 设置查询条件,排除组织id
|
||||||
|
dataScopeWithoutOrgId(wrapper);
|
||||||
|
// 按照排序字段升序排序
|
||||||
|
wrapper.orderByAsc(ApiConfigEntity::getOrderNo);
|
||||||
|
// 从数据库中查询列表数据
|
||||||
|
List<ApiConfigEntity> dataFileCategoryEntities = baseMapper.selectList(wrapper);
|
||||||
|
// 将数据转换为树节点vo列表
|
||||||
|
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(dataFileCategoryEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
|
// 设置树节点的标签为名称
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
// 设置树节点的值为id
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
// 设置树节点是否不可用,类型为0表示不可用
|
||||||
|
newItem.setDisabled(oldItem.getType() == 0);
|
||||||
|
// 如果树节点路径包含斜杠,则设置父路径为路径截取到倒数第一个斜杠的位置
|
||||||
|
if (newItem.getPath().contains("/")) {
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 调用工具类构建树结构
|
||||||
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询API配置信息
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<ApiConfig> page(ApiConfigQuery query) {
|
||||||
|
// 调用Mapper层方法,查询分页数据
|
||||||
|
IPage<ApiConfigEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||||
|
|
||||||
|
// 将查询结果转换为ApiConfig对象列表
|
||||||
|
// 返回分页结果
|
||||||
|
return new PageResult<>(ApiConfigConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取ApiConfigEntity对象
|
||||||
|
*
|
||||||
|
* @param id ID值
|
||||||
|
* @return ApiConfigEntity对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ApiConfigEntity getByI(Long id) {
|
||||||
|
return id != null ? baseMapper.selectById(id) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Long id,ApiConfigEntity vo) {
|
||||||
|
baseMapper.deleteById(id);
|
||||||
|
baseMapper.insert(vo);
|
||||||
|
// if (vo.getType() == 0) {
|
||||||
|
// ApiGroupEntity apiGroupEntity = new ApiGroupEntity();
|
||||||
|
// apiGroupEntity.setId(vo.getId());
|
||||||
|
// apiGroupEntity.setVersion(vo.getVersion());
|
||||||
|
// apiGroupEntity.setDeleted(vo.getDeleted());
|
||||||
|
// apiGroupEntity.setUpdateTime(vo.getUpdateTime());
|
||||||
|
// apiGroupEntity.setCreateTime(vo.getCreateTime());
|
||||||
|
// apiGroupEntity.setUpdater(vo.getUpdater());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ApiConfigDao apiConfigDto;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xia(Long id) {
|
||||||
|
apiConfigDto.xia(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shang(Long id) {
|
||||||
|
apiConfigDto.shang(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sav(ApiConfig vo) {
|
||||||
|
|
||||||
|
|
||||||
|
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
||||||
|
entity.setPath(recursionPath(entity, null));
|
||||||
|
entity.setProjectId(getProjectId());
|
||||||
|
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByI(List<Long> idList) {
|
||||||
|
baseMapper.deleteBatchIds(idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String recursionPath(ApiConfigEntity groupEntity, String path) {
|
||||||
|
if (StringUtil.isBlank(path)) {
|
||||||
|
path = groupEntity.getName();
|
||||||
|
}
|
||||||
|
if (groupEntity.getParentId() != 0) {
|
||||||
|
ApiConfigEntity parent = getById(groupEntity.getParentId());
|
||||||
|
path = parent.getName() + "/" + path;
|
||||||
|
return recursionPath(parent, path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper getWrapper(ApiConfigQuery query) {
|
||||||
|
LambdaQueryWrapper<ApiConfigEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(StringUtil.isNotBlank(query.getName()), ApiConfigEntity::getName, query.getName());
|
||||||
|
wrapper.like(StringUtil.isNotBlank(query.getPath()), ApiConfigEntity::getPath, query.getPath());
|
||||||
|
// wrapper.eq(StringUtil.isNotBlank(query.getContentType()), ApiConfigEntity::getContentType, query.getContentType());
|
||||||
|
// wrapper.eq(query.getStatus()!= null, ApiConfigEntity::getStatus, query.getStatus());
|
||||||
|
// wrapper.eq(query.getSqlDbType() != null, ApiConfigEntity::getSqlDbType, query.getSqlDbType());
|
||||||
|
//
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.ApiGroupConvert;
|
||||||
|
import net.srt.entity.ApiConfigEntity;
|
||||||
|
import net.srt.entity.ApiGroupEntity;
|
||||||
|
import net.srt.framework.common.exception.ServerException;
|
||||||
|
import net.srt.framework.common.utils.BeanUtil;
|
||||||
|
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.mapper.ApiGroupDao;
|
||||||
|
import net.srt.service.ApiConfigService;
|
||||||
|
import net.srt.service.ApiGroupService;
|
||||||
|
import net.srt.vo.ApiGroup;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEntity> implements ApiGroupService{
|
||||||
|
// private final ApiConfigService apiConfigService;
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listTree() {
|
||||||
|
List<TreeNodeVo> treeNodeVos = getTreeNodeVos();
|
||||||
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TreeNodeVo> getTreeNodeVos() {
|
||||||
|
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
dataScopeWithoutOrgId(wrapper);
|
||||||
|
wrapper.orderByAsc(ApiGroupEntity::getOrderNo);
|
||||||
|
List<ApiGroupEntity> apiGroupEntities = baseMapper.selectList(wrapper);
|
||||||
|
return BeanUtil.copyListProperties(apiGroupEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
newItem.setDisabled(oldItem.getType() == 1);
|
||||||
|
if (newItem.getPath().contains("/")) {
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(ApiGroup vo) {
|
||||||
|
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||||
|
entity.setPath(recursionPath(entity, null));
|
||||||
|
entity.setProjectId(getProjectId());
|
||||||
|
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(ApiGroup vo) {
|
||||||
|
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||||
|
entity.setPath(recursionPath(entity, null));
|
||||||
|
entity.setProjectId(getProjectId());
|
||||||
|
updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
||||||
|
if (StringUtil.isBlank(path)) {
|
||||||
|
path = groupEntity.getName();
|
||||||
|
}
|
||||||
|
if (groupEntity.getParentId() != 0) {
|
||||||
|
ApiGroupEntity parent = getById(groupEntity.getParentId());
|
||||||
|
path = parent.getName() + "/" + path;
|
||||||
|
return recursionPath(parent, path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Long id) {
|
||||||
|
//查询有没有子节点
|
||||||
|
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(ApiGroupEntity::getParentId, id).last(" limit 1");
|
||||||
|
ApiGroupEntity one = baseMapper.selectOne(wrapper);
|
||||||
|
if (one != null) {
|
||||||
|
throw new ServerException("存在子节点,不允许删除!");
|
||||||
|
}
|
||||||
|
// //查询有没有api与之关联
|
||||||
|
// LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// serviceApiConfigWrapper.eq(ApiConfigEntity::getParentId, id).last(" limit 1");
|
||||||
|
// ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
||||||
|
// if (apiConfigEntity != null) {
|
||||||
|
// throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
||||||
|
// }
|
||||||
|
// removeById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import net.srt.convert.ApiLogConvert;
|
||||||
|
|
||||||
|
|
||||||
|
import net.srt.entity.ApiLogEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.mapper.ApiLogDao;
|
||||||
|
|
||||||
|
import net.srt.query.ApiLogQuery;
|
||||||
|
|
||||||
|
import net.srt.service.ApiLogService;
|
||||||
|
import net.srt.vo.ApiLog;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLogServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ApiLogServiceImpl extends BaseServiceImpl<ApiLogDao, ApiLogEntity> implements ApiLogService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ApiLog> pag(ApiLogQuery query) {
|
||||||
|
// 调用Mapper层方法,查询分页数据
|
||||||
|
IPage<ApiLogEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||||
|
|
||||||
|
|
||||||
|
// 将查询结果转换为ApiConfig对象列表
|
||||||
|
// 返回分页结果
|
||||||
|
return new PageResult<>(ApiLogConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper getWrapper(ApiLogQuery query) {
|
||||||
|
LambdaQueryWrapper<ApiLogEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(StringUtil.isNotBlank(query.getApiName()), ApiLogEntity::getApiName, query.getApiName());
|
||||||
|
wrapper.like(StringUtil.isNotBlank(query.getIp()), ApiLogEntity::getIp, query.getIp());
|
||||||
|
// wrapper.eq(StringUtil.isNotBlank(query.getContentType()), ApiConfigEntity::getContentType, query.getContentType());
|
||||||
|
// wrapper.eq(query.getStatus()!= null, ApiConfigEntity::getStatus, query.getStatus());
|
||||||
|
// wrapper.eq(query.getSqlDbType() != null, ApiConfigEntity::getSqlDbType, query.getSqlDbType());
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
package net.srt.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据服务-api配置
|
||||||
|
*
|
||||||
|
* @author zrx 985134801@qq.com
|
||||||
|
* @since 1.0.0 2023-01-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ApiConfig implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
private Integer parentId;
|
||||||
|
private Integer type;
|
||||||
|
private String name;
|
||||||
|
private Integer orderNo;
|
||||||
|
private String description;
|
||||||
|
private String path;
|
||||||
|
private Integer projectId;
|
||||||
|
private Integer version;
|
||||||
|
private Integer deleted;
|
||||||
|
private Integer creator;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
private Integer updater;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
private Integer status;
|
||||||
|
private String contentType;
|
||||||
|
private Integer releaseUserId;
|
||||||
|
private Date releaseTime;
|
||||||
|
private Integer previlege;
|
||||||
|
private Integer openTrans;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @TableId(value = "id", type = IdType.AUTO)
|
||||||
|
// private Long id;
|
||||||
|
// private Long groupId;
|
||||||
|
// private String path;
|
||||||
|
// private String type;
|
||||||
|
// private String name;
|
||||||
|
//// private String note;
|
||||||
|
// private String sqlText;
|
||||||
|
// private String sqlSeparator;
|
||||||
|
// private Integer sqlMaxRow;
|
||||||
|
// private String sqlParam;
|
||||||
|
// private String jsonParam;
|
||||||
|
// private String responseResult;
|
||||||
|
// private Integer contentType;
|
||||||
|
// private Integer status
|
||||||
|
// private Date releaseTime;
|
||||||
|
// private Long releaseUserId;
|
||||||
|
// private Integer sqlDbType;
|
||||||
|
// private Long databaseId;
|
||||||
|
// private Integer previlege;
|
||||||
|
// private Integer openTrans;
|
||||||
|
// private Long projectId;
|
||||||
|
// private Integer version;
|
||||||
|
// private Integer deleted;
|
||||||
|
// private Long creator;
|
||||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
// private Date createTime;
|
||||||
|
// private Long updater;
|
||||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
// private Date updateTime;
|
||||||
|
// private Integer requestedTimes;
|
||||||
|
// private Integer requestedSuccessTimes;
|
||||||
|
// private Integer requestedFailedTimes;
|
||||||
|
// private Long authId;
|
||||||
|
// private String group;
|
||||||
|
// private String groupPath;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package net.srt.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApiGroup implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
private Long parentId;
|
||||||
|
private Integer type;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private Integer orderNo;
|
||||||
|
private String path;
|
||||||
|
private Long projectId;
|
||||||
|
private Integer version;
|
||||||
|
private Integer deleted;
|
||||||
|
private Long creator;
|
||||||
|
private Date createTime;
|
||||||
|
private Long updater;
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package net.srt.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ApiLog
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ApiLog implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String url;
|
||||||
|
private Integer duration;
|
||||||
|
private String ip;
|
||||||
|
private Integer apiId;
|
||||||
|
private String error;
|
||||||
|
private Integer projectId;
|
||||||
|
private String deleted;
|
||||||
|
private Integer creator;
|
||||||
|
private String createTime;
|
||||||
|
private Integer updater;
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
auth:
|
||||||
|
ignore_urls:
|
||||||
|
- /auth/captcha
|
||||||
|
- /auth/login
|
||||||
|
- /auth/send/code
|
||||||
|
- /auth/mobile
|
||||||
|
- /upload/**
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--status用于设置log4j2框架内部的日志信息输出,设置成OFF将禁止log4j2内部日志输出,毕竟这个日志对我们没有什么作用,如果设置成trace,你会看到log4j2内部各种详细输出;monitorInterval是监控间隔,例如下面的设置是指:log4j2每隔600秒自动监控该配置文件是否有变化,如果有变化,则根据文件内容新的配置生成日志-->
|
||||||
|
<configuration status="OFF" monitorInterval="600">
|
||||||
|
<Properties>
|
||||||
|
<property name="LOG_PATH">./logs/</property>
|
||||||
|
<property name="LOG_FILE">srt-cloud-system</property>
|
||||||
|
</Properties>
|
||||||
|
<!--定义添加器-->
|
||||||
|
<appenders>
|
||||||
|
<!--Console是输出控制台的标签,target可以控制往控制台输出日志的颜色,例如SYSTEM_OUT就是蓝色的,SYSTEM_ERR就是红色的-->
|
||||||
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
|
<!--控制台只输出level及以上级别的信息,onMatch为true代表符合level标准的才输出,onMismatch为true代表不符合level标准的就不输出-->
|
||||||
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="ACCEPT"/>
|
||||||
|
<!--这个是输出日志的格式,如果对里面的参数不理解,可以去看我的这篇文章,网址是:“https://blog.csdn.net/qq_42449963/article/details/104617356”-->
|
||||||
|
<!--<PatternLayout pattern=" %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>-->
|
||||||
|
<PatternLayout
|
||||||
|
pattern=" %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%6p} %style{%5pid}{bright,magenta} --- [%15.15t] %style{%c{20}}{bright,cyan}: %m%n"/>
|
||||||
|
</Console>
|
||||||
|
|
||||||
|
<!--这种存储文件的方式更加合理,可以设置多长时间把文件归档一次,也可以设置多大文件归档一次,如果都把所有的日志存在一个文件里面,文件会受不了的,解释一下参数信息:fileName后面如果后面不跟/,例如dev/logs/app.log,那就会把日志文件放在project工程下面,不是所属的项目下面如果后面跟/,例如/dev/logs/app.log,那就会把日志文件直接放在项目所在盘符的根目录下,例如项目在E盘存放,那就会把日志文件直接放在E盘的根目录下,如果后面直接加盘符,那就会存在特定的位置,例如F:/dev/logs/app.log,那就会直接放在F盘中特定的位置,上面都是经过测验的,fileName后面的app.log文件相当于是一个缓存文件,我们会把日志信息先放在app.log中,当达到我们设置的要求之后会把app.log中的日志信息转移到filePattern指定的日志文件中,转移的内容就会从app.log日志文件中清除,没有转移的内容还存放在app.log中,等到下一次符合要求的时候在进行一次转移-->
|
||||||
|
<!--$${date:yyyy-MM}用在文件上面,输出的是目录的名字,例如2020-03,%d{MM-dd-yyyy}输入的就是月日年,例如03-02-2020,%i按照轮询输出,毕竟一天可能有符合要求的多个日志文件生成,所以需要在后面加一个类似于后缀的东西,当天的第一个日志文件可能是-1.log.gz,第二个文件就是-2.log.gz-->
|
||||||
|
<RollingFile name="RollingFile" fileName="${LOG_PATH}/${LOG_FILE}.log"
|
||||||
|
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${LOG_FILE}-%d{yyyy-MM-dd}-%i.log">
|
||||||
|
<!--%thread:线程名;%-5level:级别从左显示5个字符宽度;%msg:在代码中需要输出的日志消息;%class{36}:估计显示的是完整类名-->
|
||||||
|
<PatternLayout pattern=" %d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n"/>
|
||||||
|
<!--<SizeBasedTriggeringPolicy size="300MB"/>-->
|
||||||
|
<Policies>
|
||||||
|
<!--TimeBasedTriggeringPolicy基于时间的触发策略,integer属性和上面<RollingFile>标签中的filePattern的值有关,例如:filePattern=”xxx%d{yyyy-MM-dd}xx” interval=”1” 表示将1天一个日志文件;filePattern=”xxx%d{yyyy-MM-dd-HH}xxx” interval=”1”表示一个小时一个日志文件,也就是说interval的单位取决于filePattern中的最小时间单位;modulate是(boolean)以0点钟为边界进行偏移计算,应该就是假设你中午启动项目,晚上0点也是一天了,而不是经过24小时才算一天-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
|
<!--当app.log文件大小到达100MB的时候,就归档一次日志文件,也就是把app.log中的那前面100MB文件取出来,放到上面<RollingFile >中的filePattern后面的路径中-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100MB"/>
|
||||||
|
</Policies>
|
||||||
|
</RollingFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<loggers>
|
||||||
|
<logger name="net.srt.system.dao" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
</logger>
|
||||||
|
<!--level="info"代表只能打印出info及其以上的信息;Console是上面Console标签的名字,往这一写,就可以往控制台上输出内容了,RollingFile是上面RollingFile标签的名字,往这一写,就会往设定的文件中输出内容了;当程序运行的时候就会被创建日志输出文件,不过里面没有任何日志内容,是否往里面输入日志,是通过下面的appender-ref标签控制的-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
<!--一般不使用这个,只是让你知道有这个输出日志文件的方式而已-->
|
||||||
|
<!--<appender-ref ref="File"/>-->
|
||||||
|
<appender-ref ref="RollingFile"/>
|
||||||
|
</root>
|
||||||
|
</loggers>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="net.srt.mapper.ApiConfigDao">
|
||||||
|
|
||||||
|
|
||||||
|
<update id="xia" parameterType="java.lang.Long">
|
||||||
|
update data_dispatch_catalogue set status = 0 where id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="shang" parameterType="java.lang.Long">
|
||||||
|
update data_dispatch_catalogue set status = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -198,13 +198,20 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
|
||||||
/**
|
/**
|
||||||
* MyBatis-Plus 数据权限
|
* MyBatis-Plus 数据权限
|
||||||
*/
|
*/
|
||||||
|
// protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
||||||
|
// DataScope dataScope = getDataScope(null, null, null, null, false, true);
|
||||||
|
// if (dataScope != null) {
|
||||||
|
// queryWrapper.apply(dataScope.getSqlFilter());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
||||||
DataScope dataScope = getDataScope(null, null, null, null, false, true);
|
DataScope dataScope = this.getDataScope((String)null, (String)null, (String)null, (String)null, false, true);
|
||||||
if (dataScope != null) {
|
if (dataScope != null) {
|
||||||
queryWrapper.apply(dataScope.getSqlFilter());
|
queryWrapper.apply(dataScope.getSqlFilter(), new Object[0]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* MyBatis-Plus 数据权限
|
* MyBatis-Plus 数据权限
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -101,11 +101,11 @@
|
||||||
|
|
||||||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlreader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlreader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||||
-->
|
-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.alibaba.datax</groupId>
|
<!-- <groupId>com.alibaba.datax</groupId>-->
|
||||||
<artifactId>mysqlreader</artifactId>
|
<!-- <artifactId>mysqlreader</artifactId>-->
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlwriter -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlwriter -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||||
-->
|
-->
|
||||||
|
@ -117,11 +117,11 @@
|
||||||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=oraclereader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=oraclereader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.alibaba.datax</groupId>
|
<!-- <groupId>com.alibaba.datax</groupId>-->
|
||||||
<artifactId>oraclereader</artifactId>
|
<!-- <artifactId>oraclereader</artifactId>-->
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!--httpclient-->
|
<!--httpclient-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
Loading…
Reference in New Issue