fjj9.0
parent
efd89a17ab
commit
68d232653b
3
pom.xml
3
pom.xml
|
@ -24,7 +24,8 @@
|
|||
<module>srt-cloud-gateway</module>
|
||||
<module>srt-data-development</module>
|
||||
<module>srt-cloud-data-governance</module>
|
||||
<module>srt-cloud-data-server</module>
|
||||
<module>srt-cloud-data-service</module>
|
||||
<module>srt-cloud-data-assets</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>srt-cloud-data-server</artifactId>
|
||||
<artifactId>srt-cloud-data-assets</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
@ -34,24 +34,15 @@
|
|||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.srt</groupId>
|
||||
<artifactId>srt-cloud-dbswitch</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<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>
|
||||
|
@ -60,14 +51,38 @@
|
|||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.huaweicloud</groupId>
|
||||
<artifactId>esdk-obs-java-bundle</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- <finalName>${project.artifactId}</finalName>-->
|
||||
<!--<finalName>${project.artifactId}</finalName>-->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
|
@ -105,7 +120,7 @@
|
|||
<daemons>
|
||||
<daemon>
|
||||
<id>${project.artifactId}</id>
|
||||
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||
<mainClass>net.srt.SystemApplication</mainClass>
|
||||
<platforms>
|
||||
<platform>jsw</platform>
|
||||
</platforms>
|
||||
|
@ -160,7 +175,7 @@
|
|||
</daemons>
|
||||
<programs>
|
||||
<program>
|
||||
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||
<mainClass>net.srt.SystemApplication</mainClass>
|
||||
<id>${project.artifactId}</id>
|
||||
</program>
|
||||
</programs>
|
||||
|
@ -202,3 +217,4 @@
|
|||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -5,12 +5,17 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @ClassName : ${NAME}
|
||||
* @Description : ${description}
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-27 21:47
|
||||
*/
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class DataServiceApplication {
|
||||
public class AssetsApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataServiceApplication.class, args);
|
||||
System.out.println("==============启动成功===================");
|
||||
SpringApplication.run(AssetsApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
server:
|
||||
port: 8098
|
||||
|
||||
spring:
|
||||
mvc:
|
||||
servlet:
|
||||
load-on-startup: 1
|
||||
application:
|
||||
name: srt-cloud-data-assets
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 101.34.77.101:8848
|
||||
# 命名空间,默认:public
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
service: ${spring.application.name}
|
||||
group: srt2.0
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
namespace: ${spring.cloud.nacos.discovery.namespace}
|
||||
file-extension: yaml
|
||||
# 指定配置
|
||||
extension-configs:
|
||||
- data-id: datasource.yaml
|
||||
refresh: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-request-size: 100MB
|
||||
max-file-size: 1024MB
|
||||
storage:
|
||||
enabled: true
|
||||
config:
|
||||
# 存储类型:local、aliyun
|
||||
type: local
|
||||
# 访问域名
|
||||
domain: http://localhost:8082/sys
|
||||
# 配置访问前缀
|
||||
prefix:
|
||||
local:
|
||||
# 本地上传路径
|
||||
path: D://upload
|
||||
|
||||
cbx:
|
||||
isCaptcha: false
|
|
@ -25,10 +25,10 @@ public class BusinessInitializer implements ApplicationRunner {
|
|||
* init task monitor
|
||||
*/
|
||||
private void initScheduleMonitor() {
|
||||
//处理没执行完的采集任务
|
||||
metadataCollectRecordService.dealNotFinished();
|
||||
//处理没执行完的质量检测任务
|
||||
qualityTaskService.dealNotFinished();
|
||||
// //处理没执行完的采集任务
|
||||
// metadataCollectRecordService.dealNotFinished();
|
||||
// //处理没执行完的质量检测任务
|
||||
// qualityTaskService.dealNotFinished();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DatastandardVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:05
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
public class DatastandardVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String 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 ifStandardRel;
|
||||
private String group;
|
||||
}
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-质量规则配置")
|
||||
public class QualityConfigVO implements Serializable {
|
||||
public class QualityConfigVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "自增id")
|
|
@ -1,119 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
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;
|
||||
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
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;
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
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;
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
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> {
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
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> {
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
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;
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
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;
|
||||
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?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>
|
|
@ -11,30 +11,5 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
public class DataServiceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataServiceApplication.class, args);
|
||||
System.out.println("\n" +
|
||||
"/**\n" +
|
||||
" * _ooOoo_\n" +
|
||||
" * o8888888o\n" +
|
||||
" * 88\" . \"88\n" +
|
||||
" * (| -_- |)\n" +
|
||||
" * O\\ = /O\n" +
|
||||
" * ____/`---'\\____\n" +
|
||||
" * . ' \\\\| |// `.\n" +
|
||||
" * / \\\\||| : |||// \\\n" +
|
||||
" * / _||||| -:- |||||- \\\n" +
|
||||
" * | | \\\\\\ - /// | |\n" +
|
||||
" * | \\_| ''\\---/'' | |\n" +
|
||||
" * \\ .-\\__ `-` ___/-. /\n" +
|
||||
" * ___`. .' /--.--\\ `. . __\n" +
|
||||
" * .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
|
||||
" * | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
||||
" * \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
|
||||
" * ======`-.____`-.___\\_____/___.-`____.-'======\n" +
|
||||
" * `=---='\n" +
|
||||
" *\n" +
|
||||
" * .............................................\n" +
|
||||
" * 佛祖保佑 代码 启动 永无BUG\n" +
|
||||
" */\n" +
|
||||
"————————代码——启动————————");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.srt.framework.common.utils.Result;
|
|||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.service.ApiConfigService;
|
||||
import net.srt.vo.ApiConfigVo;
|
||||
import net.srt.vo.DataServiceApiAuthVo;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
@ -42,13 +43,33 @@ public class ApiConfigController {
|
|||
}
|
||||
|
||||
@GetMapping("page-auth")
|
||||
@Operation(summary = "根据resourceId分页获取")
|
||||
public Result<PageResult<ApiConfigVo>> pageAuth(@Valid ApiConfigQuery query) {
|
||||
PageResult<ApiConfigVo> page = apiConfigService.page(query);
|
||||
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
//取消授权
|
||||
// @PutMapping("/auth-info")
|
||||
// @Operation(summary = "修改授权")
|
||||
// public Result<String> upAuth(@RequestBody DataServiceApiAuthVo authVO){
|
||||
// apiConfigService.upAuth(authVO);
|
||||
// return Result.ok();
|
||||
// }
|
||||
@Operation(summary = "回显")
|
||||
@GetMapping(value = "/auth-info/{authId}")
|
||||
public Result<DataServiceApiAuthVo> getAuthId(@PathVariable Long authId){
|
||||
return Result.ok(apiConfigService.getAuthInfo(authId));
|
||||
}
|
||||
|
||||
//重置调用次数
|
||||
@Operation(summary = "重置调用次数")
|
||||
@PutMapping("/reset-requested/{authId}")
|
||||
public Result<String > resetRequested(@PathVariable Long authId){
|
||||
apiConfigService.resetRequested(authId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package net.srt.controller;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthController
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-26 15:22
|
||||
*/
|
||||
public class DataServiceApiAuthController {
|
||||
}
|
|
@ -34,12 +34,12 @@ public class DataServiceAppController {
|
|||
PageResult<DataServiceAppVo> pageResult = dataServiceAppService.page(query);
|
||||
return Result.ok(pageResult);
|
||||
}
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<DataServiceAppVo> get(@PathVariable("id") Long id){
|
||||
DataServiceAppEntity dataServiceAppEntity = dataServiceAppService.getById(id);
|
||||
return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceAppEntity));
|
||||
}
|
||||
// @GetMapping("{id}")
|
||||
// @Operation(summary = "信息")
|
||||
// public Result<DataServiceAppVo> get(@PathVariable("id") Long id){
|
||||
// DataServiceAppEntity dataServiceAppEntity = dataServiceAppService.getById(id);
|
||||
// return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceAppEntity));
|
||||
// }
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
|
@ -72,6 +72,7 @@ public class DataServiceAppController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/auth")
|
||||
@Operation(summary = "修改授权")
|
||||
public Result<String> upAuth(@RequestBody DataServiceApiAuthVo authVO){
|
||||
|
|
|
@ -17,4 +17,6 @@ public interface ApiConfigDao extends BaseDao<ApiConfigEntity> {
|
|||
void updateById(@Param("apiId") Long apiId, @Param("id") Long id);
|
||||
|
||||
List<ApiConfigEntity> getAuthList(Map<String, Object> params);
|
||||
|
||||
void updateAuthId(@Param("authId") Long authId);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.srt.dao;
|
|||
import net.srt.entity.DataServiceApiAuthEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthDao
|
||||
|
@ -12,4 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface DataServiceApiAuthDao extends BaseDao<DataServiceApiAuthEntity> {
|
||||
void resetRequested(Long authId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
@ -18,8 +15,10 @@ import java.util.Date;
|
|||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_service_api_auth1")
|
||||
@TableName("data_service_api_auth")
|
||||
public class DataServiceApiAuthEntity extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* app的id
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_service_api_log1")
|
||||
@TableName("data_service_api_log")
|
||||
public class DataServiceApiLogEntity extends BaseEntity {
|
||||
/**
|
||||
* url
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.srt.framework.common.page.PageResult;
|
|||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.vo.ApiConfigVo;
|
||||
import net.srt.vo.DataServiceApiAuthVo;
|
||||
import srt.cloud.framework.dbswitch.core.model.JdbcSelectResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -37,4 +38,10 @@ public interface ApiConfigService extends BaseService<ApiConfigEntity> {
|
|||
JdbcSelectResult sqlExecute(SqlDto dto);
|
||||
|
||||
void exportDocs(List<Long> ids, HttpServletResponse response);
|
||||
|
||||
void upAuth(DataServiceApiAuthVo authVO);
|
||||
|
||||
DataServiceApiAuthVo getAuthInfo(Long authId);
|
||||
|
||||
void resetRequested(Long authId);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.ServerNames;
|
||||
import net.srt.convert.ApiConfigConvert;
|
||||
import net.srt.convert.DataServiceApiAuthConvert;
|
||||
import net.srt.dao.ApiConfigDao;
|
||||
import net.srt.dao.ApiGroupDao;
|
||||
import net.srt.dao.DataServiceApiAuthDao;
|
||||
import net.srt.dto.SqlDto;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.entity.DataServiceApiAuthEntity;
|
||||
import net.srt.framework.common.constant.Constant;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
|
@ -18,6 +21,7 @@ import net.srt.framework.security.user.SecurityUser;
|
|||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.service.ApiConfigService;
|
||||
import net.srt.vo.ApiConfigVo;
|
||||
import net.srt.vo.DataServiceApiAuthVo;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -42,6 +46,7 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
|||
private final ApiGroupDao apiGroupDao;
|
||||
private final DiscoveryClient discoveryClient;
|
||||
private final ApiConfigDao apiConfigDao;
|
||||
private final DataServiceApiAuthDao dataServiceApiAuthDao;
|
||||
private final Map<String, ApiConfigEntity> mappings = new ConcurrentHashMap<>();
|
||||
@Override
|
||||
public String getIpPort() {
|
||||
|
@ -168,6 +173,22 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upAuth(DataServiceApiAuthVo authVO) {
|
||||
dataServiceApiAuthDao.updateById(DataServiceApiAuthConvert.INSTANCE.convert(authVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataServiceApiAuthVo getAuthInfo(Long authId) {
|
||||
return DataServiceApiAuthConvert.INSTANCE.convert(dataServiceApiAuthDao.selectById(authId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetRequested(Long authId) {
|
||||
dataServiceApiAuthDao.resetRequested(authId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<ApiConfigVo> page(ApiConfigQuery query) {
|
||||
// 查询参数
|
||||
|
|
|
@ -53,6 +53,7 @@ public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao
|
|||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void update1(DataServiceAppVo vo) {
|
||||
DataServiceAppEntity app = DataServiceAppConvert.INSTANCE.convert(vo);
|
||||
|
@ -69,19 +70,23 @@ public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao
|
|||
authVO.setProjectId(getProjectId());
|
||||
DataServiceApiAuthEntity entity = DataServiceApiAuthConvert.INSTANCE.convert(authVO);
|
||||
dataServiceApiAuthDao.insert(entity);
|
||||
Long id = entity.getId();
|
||||
Long id = entity.getApiId();
|
||||
apiConfigDao.updateById(authVO.getApiId(),id);
|
||||
|
||||
}
|
||||
|
||||
//修改授权
|
||||
@Override
|
||||
public void upAuth(DataServiceApiAuthVo authVO) {
|
||||
dataServiceApiAuthDao.updateById(DataServiceApiAuthConvert.INSTANCE.convert(authVO));
|
||||
DataServiceApiAuthEntity entity = DataServiceApiAuthConvert.INSTANCE.convert(authVO);
|
||||
dataServiceApiAuthDao.updateById(entity);
|
||||
}
|
||||
|
||||
//取消授权
|
||||
@Override
|
||||
public void cancelAuth(Long authId) {
|
||||
dataServiceAppDao.deleteById(authId);
|
||||
dataServiceApiAuthDao.deleteById(authId);
|
||||
apiConfigDao.updateAuthId(authId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,5 +51,6 @@ public class ApiConfigVo implements Serializable {
|
|||
private Long authId;
|
||||
private String group;
|
||||
private String groupPath;
|
||||
private Integer previlege;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,27 +19,27 @@ import java.util.Date;
|
|||
public class DataServiceApiAuthVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "app的id")
|
||||
@Schema(description = "appId")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "分组id")
|
||||
@Schema(description = "groupId")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "api的id")
|
||||
@Schema(description = "apiId")
|
||||
private Long apiId;
|
||||
|
||||
@Schema(description = "调用次数 不限次数为-1")
|
||||
@Schema(description = "调用的次数:不限次数为-1")
|
||||
private Integer requestTimes;
|
||||
|
||||
@Schema(description = "已调用次数")
|
||||
@Schema(description = "已调次数")
|
||||
private Integer requestedTimes;
|
||||
private Integer requestedSuccessTimes;
|
||||
private Integer requestedFailedTimes;
|
||||
|
||||
@Schema(description = "所属项目id")
|
||||
@Schema(description = "所属项目的id")
|
||||
private Long projectId;
|
||||
|
||||
private Long authId;
|
||||
|
@ -47,7 +47,7 @@ public class DataServiceApiAuthVo implements Serializable {
|
|||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
@Schema(description = "删除标识 0是正常 1是已删除")
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
<update id="updateById">
|
||||
update data_service_api_config set auth_id=#{apiId} where id=#{id}
|
||||
</update>
|
||||
<update id="updateAuthId">
|
||||
update data_service_api_config set auth_id=null where auth_id=#{authId}
|
||||
</update>
|
||||
<select id="getResourceList" resultType="net.srt.entity.ApiConfigEntity">
|
||||
<choose>
|
||||
<when test="queryApply!=null and queryApply==1">
|
||||
|
@ -38,7 +41,7 @@
|
|||
FROM
|
||||
data_service_api_config dsac
|
||||
INNER JOIN data_service_api_group dsag ON dsac.group_id=dsag.id
|
||||
INNER JOIN data_service_api_auth1 dsaa ON dsac.id = dsaa.api_id
|
||||
INNER JOIN data_service_api_auth dsaa ON dsac.id = dsaa.api_id
|
||||
WHERE
|
||||
dsaa.app_id=#{appId}
|
||||
AND dsac.deleted=0
|
||||
|
@ -50,11 +53,11 @@
|
|||
dsaa.id AS auth_id
|
||||
FROM
|
||||
data_service_api_config dsac
|
||||
LEFT JOIN data_service_api_auth1 dsaa ON dsac.id = dsaa.api_id AND dsaa.app_id=#{appId}
|
||||
LEFT JOIN data_service_api_auth dsaa ON dsac.id = dsaa.api_id AND dsaa.app_id=#{appId}
|
||||
AND dsaa.deleted=0
|
||||
WHERE
|
||||
dsac.group_id = #{groupId}
|
||||
AND dsac.previlege=1
|
||||
AND dsac.privates=1
|
||||
AND dsac.deleted=0
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
@ -67,7 +70,7 @@
|
|||
<if test="contentType != null and contentType.trim() != ''">
|
||||
AND dsac.content_type = #{contentType}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
<if test="status != ">
|
||||
AND dsac.status = #{status}
|
||||
</if>
|
||||
<if test="sqlDbType != null">
|
||||
|
@ -76,8 +79,8 @@
|
|||
<if test="databaseId != null">
|
||||
AND dsac.database_id = #{databaseId}
|
||||
</if>
|
||||
<if test="previlege != null">
|
||||
AND dsac.previlege = #{previlege}
|
||||
<if test="privates != null">
|
||||
AND dsac.privates = #{privates}
|
||||
</if>
|
||||
<if test="openTrans != null">
|
||||
AND dsac.open_trans = #{openTrans}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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.dao.DataServiceApiAuthDao">
|
||||
|
||||
|
||||
<update id="resetRequested">
|
||||
UPDATE data_service_api_auth SET requested_times=0,requested_success_times=0,requested_failed_times=0 WHERE id =#{id}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue