Compare commits
2 Commits
ac452af8ed
...
efd89a17ab
Author | SHA1 | Date |
---|---|---|
|
efd89a17ab | |
|
f7fb97d164 |
|
@ -18,6 +18,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
public class GovernanceApplication {
|
public class GovernanceApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(GovernanceApplication.class, args);
|
SpringApplication.run(GovernanceApplication.class, args);
|
||||||
|
System.out.println("原神启动!!!!!!!!!!!!!");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,90 +1,92 @@
|
||||||
package net.srt.controller;
|
//package net.srt.controller;
|
||||||
|
//
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
//import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
//import lombok.AllArgsConstructor;
|
||||||
import net.srt.framework.common.cache.bean.Neo4jInfo;
|
//import net.srt.framework.common.cache.bean.Neo4jInfo;
|
||||||
import net.srt.framework.common.utils.Result;
|
//import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.framework.common.utils.TreeNodeVo;
|
//import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.service.MetadataService;
|
//import net.srt.service.MetadataService;
|
||||||
import net.srt.vo.MetadataVO;
|
//
|
||||||
import org.springframework.web.bind.annotation.*;
|
//import net.srt.vo.MetadataVO;
|
||||||
|
//import org.springframework.web.bind.annotation.*;
|
||||||
import javax.validation.Valid;
|
//
|
||||||
import java.util.List;
|
//import javax.validation.Valid;
|
||||||
|
//import java.util.List;
|
||||||
@RestController
|
//
|
||||||
@RequestMapping("metadata")
|
//@RestController
|
||||||
@Tag(name = "数据治理-元数据")
|
//@RequestMapping("metadata")
|
||||||
@AllArgsConstructor
|
//@Tag(name = "数据治理-元数据")
|
||||||
public class MetadataController {
|
//@AllArgsConstructor
|
||||||
private final MetadataService metadataService;
|
//public class MetadataController {
|
||||||
|
//
|
||||||
@GetMapping("/list-child")
|
// private final MetadataService metadataService;
|
||||||
@Operation(summary = "根据父级id获取信息")
|
//
|
||||||
public Result<List<TreeNodeVo>> listByParentId(@RequestParam Long parentId){
|
// @GetMapping("/list-child")
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listByParentId(parentId);
|
// @Operation(summary = "根据父级id获取信息")
|
||||||
return Result.ok(treeNodeVos);
|
// public Result<List<TreeNodeVo>> listByParentId(@RequestParam Long parentId){
|
||||||
}
|
// List<TreeNodeVo> treeNodeVos = metadataService.listByParentId(parentId);
|
||||||
|
// return Result.ok(treeNodeVos);
|
||||||
@GetMapping("/list-floder")
|
// }
|
||||||
@Operation(summary = "获取目录树")
|
//
|
||||||
public Result<List<TreeNodeVo>> listFloder(){
|
// @GetMapping("/list-floder")
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listFloder();
|
// @Operation(summary = "获取目录树")
|
||||||
return Result.ok(treeNodeVos);
|
// public Result<List<TreeNodeVo>> listFloder(){
|
||||||
}
|
// List<TreeNodeVo> treeNodeVos = metadataService.listFloder();
|
||||||
|
// return Result.ok(treeNodeVos);
|
||||||
@GetMapping("/list-db")
|
// }
|
||||||
@Operation(summary = "获取库表目录树")
|
//
|
||||||
public Result<List<TreeNodeVo>> listDb(){
|
// @GetMapping("/list-db")
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listDb();
|
// @Operation(summary = "获取库表目录树")
|
||||||
return Result.ok(treeNodeVos);
|
// public Result<List<TreeNodeVo>> listDb(){
|
||||||
}
|
// List<TreeNodeVo> treeNodeVos = metadataService.listDb();
|
||||||
|
// return Result.ok(treeNodeVos);
|
||||||
@GetMapping("/list-keyword")
|
// }
|
||||||
@Operation(summary = "模糊查询")
|
//
|
||||||
public Result<List<TreeNodeVo>> listByKeyword(String keyword){
|
// @GetMapping("/list-keyword")
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listByKeyword(keyword);
|
// @Operation(summary = "模糊查询")
|
||||||
return Result.ok(treeNodeVos);
|
// public Result<List<TreeNodeVo>> listByKeyword(String keyword){
|
||||||
}
|
// List<TreeNodeVo> treeNodeVos = metadataService.listByKeyword(keyword);
|
||||||
|
// return Result.ok(treeNodeVos);
|
||||||
@GetMapping("{id}")
|
// }
|
||||||
@Operation(summary = "信息")
|
//
|
||||||
public Result<MetadataVO> get(@PathVariable("id") Long id){
|
// @GetMapping("{id}")
|
||||||
return Result.ok(metadataService.get(id));
|
// @Operation(summary = "信息")
|
||||||
}
|
// public Result<MetadataVO> get(@PathVariable("id") Long id){
|
||||||
|
// return Result.ok(metadataService.get(id));
|
||||||
@PostMapping
|
// }
|
||||||
@Operation(summary = "保存")
|
//
|
||||||
public Result<String> save(@RequestBody MetadataVO vo){
|
// @PostMapping
|
||||||
metadataService.save(vo);
|
// @Operation(summary = "保存")
|
||||||
return Result.ok();
|
// public Result<String> save(@RequestBody MetadataVO vo){
|
||||||
}
|
// metadataService.save(vo);
|
||||||
|
// return Result.ok();
|
||||||
@PutMapping
|
// }
|
||||||
@Operation(summary = "修改")
|
//
|
||||||
public Result<String> update(@RequestBody @Valid MetadataVO vo) {
|
// @PutMapping
|
||||||
metadataService.update(vo);
|
// @Operation(summary = "修改")
|
||||||
return Result.ok();
|
// public Result<String> update(@RequestBody @Valid MetadataVO vo) {
|
||||||
}
|
// metadataService.update(vo);
|
||||||
|
// return Result.ok();
|
||||||
@DeleteMapping("{id}")
|
// }
|
||||||
@Operation(summary = "删除")
|
//
|
||||||
public Result<String> delete(@PathVariable Long id) {
|
// @DeleteMapping("{id}")
|
||||||
metadataService.delete(id);
|
// @Operation(summary = "删除")
|
||||||
return Result.ok();
|
// public Result<String> delete(@PathVariable Long id) {
|
||||||
}
|
// metadataService.delete(id);
|
||||||
|
// return Result.ok();
|
||||||
@PostMapping("/neo4j")
|
// }
|
||||||
@Operation(summary = "更新neo4j的url")
|
//
|
||||||
public Result<String> upNeo4jInfo(@RequestBody Neo4jInfo neo4jInfo){
|
// @PostMapping("/neo4j")
|
||||||
metadataService.upNeo4jInfo(neo4jInfo);
|
// @Operation(summary = "更新neo4j的url")
|
||||||
return Result.ok();
|
// public Result<String> upNeo4jInfo(@RequestBody Neo4jInfo neo4jInfo){
|
||||||
}
|
// metadataService.upNeo4jInfo(neo4jInfo);
|
||||||
|
// return Result.ok();
|
||||||
@GetMapping("/neo4j")
|
// }
|
||||||
@Operation(summary = "获取neo4j的url")
|
//
|
||||||
public Result<Neo4jInfo> getNeo4jInfo(){
|
// @GetMapping("/neo4j")
|
||||||
return Result.ok(metadataService.getNeo4jInfo());
|
// @Operation(summary = "获取neo4j的url")
|
||||||
}
|
// public Result<Neo4jInfo> getNeo4jInfo(){
|
||||||
}
|
// return Result.ok(metadataService.getNeo4jInfo());
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
|
@ -2,6 +2,10 @@ package net.srt.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import net.srt.convert.StandardConvert;
|
||||||
|
import net.srt.entity.DatastandardEntity;
|
||||||
|
import net.srt.entity.StandardEntity;
|
||||||
|
import net.srt.framework.common.utils.BeanUtil;
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.framework.common.utils.TreeNodeVo;
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.service.StandardService;
|
import net.srt.service.StandardService;
|
||||||
|
@ -9,6 +13,8 @@ import net.srt.vo.StandardManagementVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +36,13 @@ public class StandardController {
|
||||||
return Result.ok(standardService.listTree());
|
return Result.ok(standardService.listTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@Operation(summary = "信息")
|
||||||
|
public Result<StandardManagementVo> get(@PathVariable("id") Long id){
|
||||||
|
StandardEntity entity = standardService.getById(id);
|
||||||
|
|
||||||
|
return Result.ok(StandardConvert.INSTANCE.convert(entity));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "保存")
|
@Operation(summary = "保存")
|
||||||
|
@ -45,9 +58,9 @@ public class StandardController {
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping("/{id}")
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
public Result<String> delete(Long id) {
|
public Result<String> delete(@PathVariable Long id) {
|
||||||
standardService.delete(id);
|
standardService.delete(id);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StandardDao extends BaseMapper<StandardEntity> {
|
public interface StandardDao extends BaseMapper<StandardEntity> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
package net.srt.service;
|
//package net.srt.service;
|
||||||
|
//
|
||||||
import net.srt.entity.MetadataEntity;
|
//import net.srt.entity.MetadataEntity;
|
||||||
import net.srt.framework.common.cache.bean.Neo4jInfo;
|
//import net.srt.framework.common.cache.bean.Neo4jInfo;
|
||||||
import net.srt.framework.common.utils.TreeNodeVo;
|
//import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.framework.mybatis.service.BaseService;
|
//import net.srt.framework.mybatis.service.BaseService;
|
||||||
import net.srt.vo.MetadataVO;
|
//import net.srt.vo.MetadataVO;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public interface MetadataService extends BaseService<MetadataEntity> {
|
//public interface MetadataService extends BaseService<MetadataEntity> {
|
||||||
List<TreeNodeVo> listByParentId(Long parentId);
|
// List<TreeNodeVo> listByParentId(Long parentId);
|
||||||
|
//
|
||||||
List<TreeNodeVo> listFloder();
|
// List<TreeNodeVo> listFloder();
|
||||||
|
//
|
||||||
List<TreeNodeVo> listDb();
|
// List<TreeNodeVo> listDb();
|
||||||
|
//
|
||||||
List<TreeNodeVo> listByKeyword(String keyword);
|
// List<TreeNodeVo> listByKeyword(String keyword);
|
||||||
|
//
|
||||||
MetadataVO get(Long id);
|
// MetadataVO get(Long id);
|
||||||
|
//
|
||||||
void save(MetadataVO vo);
|
// void save(MetadataVO vo);
|
||||||
|
//
|
||||||
|
//
|
||||||
void update(MetadataVO vo);
|
// void update(MetadataVO vo);
|
||||||
|
//
|
||||||
void delete(Long id);
|
// void delete(Long id);
|
||||||
|
//
|
||||||
void upNeo4jInfo(Neo4jInfo neo4jInfo);
|
// void upNeo4jInfo(Neo4jInfo neo4jInfo);
|
||||||
|
//
|
||||||
Neo4jInfo getNeo4jInfo();
|
// Neo4jInfo getNeo4jInfo();
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,234 +1,233 @@
|
||||||
package net.srt.service.impl;
|
//package net.srt.service.impl;
|
||||||
|
//
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.servers.Server;
|
//import io.swagger.v3.oas.annotations.servers.Server;
|
||||||
import lombok.AllArgsConstructor;
|
//import lombok.AllArgsConstructor;
|
||||||
import net.srt.api.module.data.governance.constant.BuiltInMetamodel;
|
//import net.srt.api.module.data.governance.constant.BuiltInMetamodel;
|
||||||
import net.srt.convert.MetadataConvert;
|
//import net.srt.convert.MetadataConvert;
|
||||||
import net.srt.dao.MetadataDao;
|
//import net.srt.dao.MetadataDao;
|
||||||
import net.srt.dao.MetadataPropertyDao;
|
//import net.srt.dao.MetadataPropertyDao;
|
||||||
import net.srt.entity.MetadataEntity;
|
//import net.srt.entity.MetadataEntity;
|
||||||
import net.srt.entity.MetadataPropertyEntity;
|
//import net.srt.entity.MetadataPropertyEntity;
|
||||||
import net.srt.framework.common.cache.bean.Neo4jInfo;
|
//import net.srt.framework.common.cache.bean.Neo4jInfo;
|
||||||
import net.srt.framework.common.exception.ServerException;
|
//import net.srt.framework.common.exception.ServerException;
|
||||||
import net.srt.framework.common.utils.BeanUtil;
|
//import net.srt.framework.common.utils.BeanUtil;
|
||||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
//import net.srt.framework.common.utils.BuildTreeUtils;
|
||||||
import net.srt.framework.common.utils.TreeNodeVo;
|
//import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
//import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.srt.framework.security.cache.TokenStoreCache;
|
//import net.srt.framework.security.cache.TokenStoreCache;
|
||||||
import net.srt.service.MetadataService;
|
//import net.srt.service.MetadataService;
|
||||||
import net.srt.vo.MetadataVO;
|
//import net.srt.vo.MetadataVO;
|
||||||
import net.srt.vo.MetamodelPropertyVO;
|
//import net.srt.vo.MetamodelPropertyVO;
|
||||||
import org.springframework.stereotype.Service;
|
//import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
//import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.CollectionUtils;
|
//import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
import java.util.ArrayList;
|
//import java.util.Comparator;
|
||||||
import java.util.Comparator;
|
//import java.util.List;
|
||||||
import java.util.List;
|
//import java.util.stream.Collectors;
|
||||||
import java.util.stream.Collectors;
|
//
|
||||||
|
//@Server
|
||||||
@Service
|
//@AllArgsConstructor
|
||||||
@AllArgsConstructor
|
//public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEntity> implements MetadataService {
|
||||||
public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEntity> implements MetadataService {
|
//
|
||||||
|
// private final MetadataDao metadataDao;
|
||||||
private final MetadataDao metadataDao;
|
// private final MetadataPropertyDao metadataPropertyDao;
|
||||||
private final MetadataPropertyDao metadataPropertyDao;
|
// private final TokenStoreCache tokenStoreCache;
|
||||||
private final TokenStoreCache tokenStoreCache;
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public List<TreeNodeVo> listByParentId(Long parentId) {
|
||||||
public List<TreeNodeVo> listByParentId(Long parentId) {
|
// LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.eq(MetadataEntity::getParentId,parentId)
|
||||||
wrapper.eq(MetadataEntity::getParentId,parentId)
|
// .orderByAsc(MetadataEntity::getOrderNo);
|
||||||
.orderByAsc(MetadataEntity::getOrderNo);
|
// dataScopeWithOrgId(wrapper);
|
||||||
dataScopeWithOrgId(wrapper);
|
// List<MetadataEntity> metadataEntities = baseMapper.selectList(wrapper);
|
||||||
List<MetadataEntity> metadataEntities = baseMapper.selectList(wrapper);
|
// return BeanUtil.copyListProperties(metadataEntities,TreeNodeVo::new, (oldItem, newItem) ->{
|
||||||
return BeanUtil.copyListProperties(metadataEntities,TreeNodeVo::new, (oldItem, newItem) ->{
|
// newItem.setLabel(oldItem.getName());
|
||||||
newItem.setLabel(oldItem.getName());
|
// newItem.setValue(oldItem.getId());
|
||||||
newItem.setValue(oldItem.getId());
|
// newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||||
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
// if(newItem.getPath().contains("/")){
|
||||||
if(newItem.getPath().contains("/")){
|
// newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public List<TreeNodeVo> listFloder() {
|
||||||
public List<TreeNodeVo> listFloder() {
|
// LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.eq(MetadataEntity::getIfLeaf,1)
|
||||||
wrapper.eq(MetadataEntity::getIfLeaf,1)
|
// .orderByAsc(MetadataEntity::getOrderNo)
|
||||||
.orderByAsc(MetadataEntity::getOrderNo)
|
// .orderByAsc(MetadataEntity::getId);
|
||||||
.orderByAsc(MetadataEntity::getId);
|
// dataScopeWithOrgId(wrapper);
|
||||||
dataScopeWithOrgId(wrapper);
|
// List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
// List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas, TreeNodeVo::new, (oldItem, newItem) -> {
|
// newItem.setLabel(oldItem.getName());
|
||||||
newItem.setLabel(oldItem.getName());
|
// newItem.setValue(oldItem.getId());
|
||||||
newItem.setValue(oldItem.getId());
|
// if (newItem.getPath().contains("/")) {
|
||||||
if (newItem.getPath().contains("/")) {
|
// newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public List<TreeNodeVo> listDb() {
|
||||||
public List<TreeNodeVo> listDb() {
|
// LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.in(MetadataEntity::getMetamodelId,BuiltInMetamodel.SCHEMA.getId(),BuiltInMetamodel.TABLE.getId())
|
||||||
wrapper.in(MetadataEntity::getMetamodelId,BuiltInMetamodel.SCHEMA.getId(),BuiltInMetamodel.TABLE.getId())
|
// .or()
|
||||||
.or()
|
// .isNull(MetadataEntity::getMetamodelId)
|
||||||
.isNull(MetadataEntity::getMetamodelId)
|
// .orderByAsc(MetadataEntity::getOrderNo);
|
||||||
.orderByAsc(MetadataEntity::getOrderNo);
|
// dataScopeWithOrgId(wrapper);
|
||||||
dataScopeWithOrgId(wrapper);
|
// List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
// List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas,TreeNodeVo::new, (oldItem, newItem) -> {
|
// newItem.setLabel(oldItem.getName());
|
||||||
newItem.setLabel(oldItem.getName());
|
// newItem.setValue(oldItem.getId());
|
||||||
newItem.setValue(oldItem.getId());
|
// newItem.setDisabled(!BuiltInMetamodel.TABLE.getId().equals(oldItem.getMetamodelId()));
|
||||||
newItem.setDisabled(!BuiltInMetamodel.TABLE.getId().equals(oldItem.getMetamodelId()));
|
// if(newItem.getPath().contains("/")) {
|
||||||
if(newItem.getPath().contains("/")) {
|
// newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public List<TreeNodeVo> listByKeyword(String keyword) {
|
||||||
public List<TreeNodeVo> listByKeyword(String keyword) {
|
// if(StringUtil.isBlank(keyword)){
|
||||||
if(StringUtil.isBlank(keyword)){
|
// return listByParentId(0L);
|
||||||
return listByParentId(0L);
|
// }
|
||||||
}
|
// LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.like(MetadataEntity::getName,keyword)
|
||||||
wrapper.like(MetadataEntity::getName,keyword)
|
// .or()
|
||||||
.or()
|
// .like(MetadataEntity::getCode,keyword)
|
||||||
.like(MetadataEntity::getCode,keyword)
|
// .orderByAsc(MetadataEntity::getOrderNo)
|
||||||
.orderByAsc(MetadataEntity::getOrderNo)
|
// .orderByAsc(MetadataEntity::getId);
|
||||||
.orderByAsc(MetadataEntity::getId);
|
// dataScopeWithOrgId(wrapper);
|
||||||
dataScopeWithOrgId(wrapper);
|
// List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
// List<MetadataEntity> resultList = new ArrayList<>();
|
||||||
List<MetadataEntity> resultList = new ArrayList<>();
|
// //递归获取父级
|
||||||
//递归获取父级
|
// for (MetadataEntity metadata : metadatas) {
|
||||||
for (MetadataEntity metadata : metadatas) {
|
// recursionAddParent(metadata,resultList);
|
||||||
recursionAddParent(metadata,resultList);
|
// }
|
||||||
}
|
// List<MetadataEntity> result = resultList.stream().sorted(Comparator.comparing(MetadataEntity::getOrderNo)).collect(Collectors.toList());
|
||||||
List<MetadataEntity> result = resultList.stream().sorted(Comparator.comparing(MetadataEntity::getOrderNo)).collect(Collectors.toList());
|
// List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(result ,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(result ,TreeNodeVo::new, (oldItem, newItem) -> {
|
// newItem.setLabel(oldItem.getName());
|
||||||
newItem.setLabel(oldItem.getName());
|
// newItem.setValue(oldItem.getId());
|
||||||
newItem.setValue(oldItem.getId());
|
// newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||||
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
// if(newItem.getPath().contains("/")) {
|
||||||
if(newItem.getPath().contains("/")) {
|
// newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public MetadataVO get(Long id) {
|
||||||
public MetadataVO get(Long id) {
|
// MetadataEntity metadataEntity = getById(id);
|
||||||
MetadataEntity metadataEntity = getById(id);
|
// MetadataVO metadataVO = MetadataConvert.INSTANCE.convert(metadataEntity);
|
||||||
MetadataVO metadataVO = MetadataConvert.INSTANCE.convert(metadataEntity);
|
// metadataVO.setProperties(metadataPropertyDao.listPropertyById(id,metadataEntity.getMetamodelId()));
|
||||||
metadataVO.setProperties(metadataPropertyDao.listPropertyById(id,metadataEntity.getMetamodelId()));
|
// return metadataVO;
|
||||||
return metadataVO;
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public void save(MetadataVO vo) {
|
||||||
public void save(MetadataVO vo) {
|
// MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
||||||
MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
// entity.setProjectId(getProjectId());
|
||||||
entity.setProjectId(getProjectId());
|
// entity.setPath(recursionPath(entity,null));
|
||||||
entity.setPath(recursionPath(entity,null));
|
// buildField(entity);
|
||||||
buildField(entity);
|
// MetadataEntity parentMetadata = baseMapper.selectById(vo.getParentId());
|
||||||
MetadataEntity parentMetadata = baseMapper.selectById(vo.getParentId());
|
// if(parentMetadata != null) {
|
||||||
if(parentMetadata != null) {
|
// entity.setDbType(parentMetadata.getDbType());
|
||||||
entity.setDbType(parentMetadata.getDbType());
|
// entity.setDatasourceId(parentMetadata.getDatasourceId());
|
||||||
entity.setDatasourceId(parentMetadata.getDatasourceId());
|
// entity.setCollectTaskId(parentMetadata.getCollectTaskId());
|
||||||
entity.setCollectTaskId(parentMetadata.getCollectTaskId());
|
// }
|
||||||
}
|
// baseMapper.insert(entity);
|
||||||
baseMapper.insert(entity);
|
// buildProperties(entity,vo.getProperties());
|
||||||
buildProperties(entity,vo.getProperties());
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public void update(MetadataVO vo) {
|
||||||
public void update(MetadataVO vo) {
|
// MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
||||||
MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
// entity.setProjectId(getProjectId());
|
||||||
entity.setProjectId(getProjectId());
|
// entity.setPath(recursionPath(entity,null));
|
||||||
entity.setPath(recursionPath(entity,null));
|
// buildField(entity);
|
||||||
buildField(entity);
|
// updateById(entity);
|
||||||
updateById(entity);
|
// buildProperties(entity,vo.getProperties());
|
||||||
buildProperties(entity,vo.getProperties());
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// public void delete(Long id) {
|
||||||
public void delete(Long id) {
|
// LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.eq(MetadataEntity::getParentId,id).last("limit 1");
|
||||||
wrapper.eq(MetadataEntity::getParentId,id).last("limit 1");
|
// if(baseMapper.selectOne(wrapper)!=null){
|
||||||
if(baseMapper.selectOne(wrapper)!=null){
|
// throw new ServerException("存在子节点,不可删除!");
|
||||||
throw new ServerException("存在子节点,不可删除!");
|
// }
|
||||||
}
|
// removeById(id);
|
||||||
removeById(id);
|
// LambdaQueryWrapper<MetadataPropertyEntity> propertyWrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataPropertyEntity> propertyWrapper = new LambdaQueryWrapper<>();
|
// propertyWrapper.eq(MetadataPropertyEntity::getMetadataId,id);
|
||||||
propertyWrapper.eq(MetadataPropertyEntity::getMetadataId,id);
|
// metadataPropertyDao.delete(propertyWrapper);
|
||||||
metadataPropertyDao.delete(propertyWrapper);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public void upNeo4jInfo(Neo4jInfo neo4jInfo) {
|
||||||
public void upNeo4jInfo(Neo4jInfo neo4jInfo) {
|
// tokenStoreCache.saveNeo4jInfo(getProjectId(),neo4jInfo);
|
||||||
tokenStoreCache.saveNeo4jInfo(getProjectId(),neo4jInfo);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public Neo4jInfo getNeo4jInfo() {
|
||||||
public Neo4jInfo getNeo4jInfo() {
|
// return tokenStoreCache.getNeo4jInfo(getProjectId());
|
||||||
return tokenStoreCache.getNeo4jInfo(getProjectId());
|
// }
|
||||||
}
|
//
|
||||||
|
// private void recursionAddParent(MetadataEntity metadataEntity, List<MetadataEntity> resultList){
|
||||||
private void recursionAddParent(MetadataEntity metadataEntity, List<MetadataEntity> resultList){
|
// if(resultList.stream().noneMatch(item -> metadataEntity.getId().equals(item.getId()))) {
|
||||||
if(resultList.stream().noneMatch(item -> metadataEntity.getId().equals(item.getId()))) {
|
// resultList.add(metadataEntity);
|
||||||
resultList.add(metadataEntity);
|
// }
|
||||||
}
|
//
|
||||||
|
// if(metadataEntity.getParentId()!=0){
|
||||||
if(metadataEntity.getParentId()!=0){
|
// MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||||
MetadataEntity parent = getById(metadataEntity.getParentId());
|
// recursionAddParent(parent,resultList);
|
||||||
recursionAddParent(parent,resultList);
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
|
// private void buildField(MetadataEntity entity){
|
||||||
private void buildField(MetadataEntity entity){
|
// if(entity.getMetamodelId()!=null){
|
||||||
if(entity.getMetamodelId()!=null){
|
// entity.setIcon(metadataDao.selectById(entity.getMetamodelId()).getIcon());
|
||||||
entity.setIcon(metadataDao.selectById(entity.getMetamodelId()).getIcon());
|
// }
|
||||||
}
|
// if(entity.getIfLeaf() == 1 && entity.getMetamodelId() == null) {
|
||||||
if(entity.getIfLeaf() == 1 && entity.getMetamodelId() == null) {
|
// entity.setIcon("/src/assets/folder.png");
|
||||||
entity.setIcon("/src/assets/folder.png");
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
|
// private String recursionPath(MetadataEntity metadataEntity, String path) {
|
||||||
private String recursionPath(MetadataEntity metadataEntity, String path) {
|
// if(StringUtil.isBlank(path)){
|
||||||
if(StringUtil.isBlank(path)){
|
// path = metadataEntity.getName();
|
||||||
path = metadataEntity.getName();
|
// }
|
||||||
}
|
// if(metadataEntity.getParentId()!=0){
|
||||||
if(metadataEntity.getParentId()!=0){
|
// MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||||
MetadataEntity parent = getById(metadataEntity.getParentId());
|
// path = parent.getName() + "/" +path;
|
||||||
path = parent.getName() + "/" +path;
|
// return recursionPath(parent,path);
|
||||||
return recursionPath(parent,path);
|
// }
|
||||||
}
|
// return path;
|
||||||
return path;
|
// }
|
||||||
}
|
//
|
||||||
|
// private void buildProperties(MetadataEntity entity, List<MetamodelPropertyVO> properties){
|
||||||
private void buildProperties(MetadataEntity entity, List<MetamodelPropertyVO> properties){
|
// if(!CollectionUtils.isEmpty(properties)){
|
||||||
if(!CollectionUtils.isEmpty(properties)){
|
// LambdaQueryWrapper<MetadataPropertyEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
LambdaQueryWrapper<MetadataPropertyEntity> wrapper = new LambdaQueryWrapper<>();
|
// wrapper.eq(MetadataPropertyEntity::getMetadataId,entity.getId());
|
||||||
wrapper.eq(MetadataPropertyEntity::getMetadataId,entity.getId());
|
// for (MetamodelPropertyVO property : properties) {
|
||||||
for (MetamodelPropertyVO property : properties) {
|
// MetadataPropertyEntity metadataPropertyEntity = new MetadataPropertyEntity();
|
||||||
MetadataPropertyEntity metadataPropertyEntity = new MetadataPropertyEntity();
|
// metadataPropertyEntity.setMetamodelPropertyId(property.getId());
|
||||||
metadataPropertyEntity.setMetamodelPropertyId(property.getId());
|
// metadataPropertyEntity.setMetadataId(entity.getId());
|
||||||
metadataPropertyEntity.setMetadataId(entity.getId());
|
// metadataPropertyEntity.setProperty(property.getValue());
|
||||||
metadataPropertyEntity.setProperty(property.getValue());
|
// metadataPropertyEntity.setProjectId(entity.getProjectId());
|
||||||
metadataPropertyEntity.setProjectId(entity.getProjectId());
|
// if(property.getMetadataPropertyId()!=null){
|
||||||
if(property.getMetadataPropertyId()!=null){
|
// metadataPropertyEntity.setId(property.getMetadataPropertyId());
|
||||||
metadataPropertyEntity.setId(property.getMetadataPropertyId());
|
// metadataPropertyDao.updateById(metadataPropertyEntity);
|
||||||
metadataPropertyDao.updateById(metadataPropertyEntity);
|
// }else {
|
||||||
}else {
|
// metadataPropertyDao.insert(metadataPropertyEntity);
|
||||||
metadataPropertyDao.insert(metadataPropertyEntity);
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||||
import net.srt.controller.StandardController;
|
import net.srt.controller.StandardController;
|
||||||
import net.srt.convert.StandardConvert;
|
import net.srt.convert.StandardConvert;
|
||||||
import net.srt.dao.StandardDao;
|
import net.srt.dao.StandardDao;
|
||||||
|
import net.srt.entity.MetamodelEntity;
|
||||||
import net.srt.entity.StandardEntity;
|
import net.srt.entity.StandardEntity;
|
||||||
import net.srt.framework.common.exception.ServerException;
|
import net.srt.framework.common.exception.ServerException;
|
||||||
import net.srt.framework.common.utils.BeanUtil;
|
import net.srt.framework.common.utils.BeanUtil;
|
||||||
|
@ -66,7 +67,7 @@ public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEn
|
||||||
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
||||||
entity.setPath(recursionPath(entity, null));
|
entity.setPath(recursionPath(entity, null));
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
updateById(entity);
|
baseMapper.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEn
|
||||||
if (one != null) {
|
if (one != null) {
|
||||||
throw new ServerException("存在子节点,不允许删除!");
|
throw new ServerException("存在子节点,不允许删除!");
|
||||||
}
|
}
|
||||||
|
//删除
|
||||||
removeById(id);
|
removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,149 +25,95 @@ import java.util.List;
|
||||||
public class ApiConfigController {
|
public class ApiConfigController {
|
||||||
private final ApiConfigService apiConfigService;
|
private final ApiConfigService apiConfigService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询接口配置列表
|
|
||||||
* @param query 查询条件
|
|
||||||
* @return 接口配置列表分页结果
|
|
||||||
*/
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页查询接口配置列表")
|
@Operation(summary = "分页")
|
||||||
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||||
public Result<PageResult<ApiConfigVo>> page(@Valid ApiConfigQuery query) {
|
public Result<PageResult<ApiConfigVo>> page(@Valid ApiConfigQuery query) {
|
||||||
PageResult<ApiConfigVo> page = apiConfigService.page(query); // 调用service层方法获取分页结果
|
PageResult<ApiConfigVo> page = apiConfigService.page(query);
|
||||||
return Result.ok(page); // 封装返回结果并返回
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return Result.ok(page);
|
||||||
* 根据resourceId分页获取接口配置列表
|
}
|
||||||
* @param query 查询条件
|
|
||||||
* @return 符合条件的接口配置列表的分页结果
|
|
||||||
*/
|
|
||||||
@GetMapping("page-resource")
|
@GetMapping("page-resource")
|
||||||
@Operation(summary = "根据resourceId分页获取接口配置列表")
|
@Operation(summary = "根据resourceId分页获取")
|
||||||
public Result<PageResult<ApiConfigVo>> pageResource(@Valid ApiConfigQuery query){
|
public Result<PageResult<ApiConfigVo>> pageResource(@Valid ApiConfigQuery query){
|
||||||
PageResult<ApiConfigVo> page = apiConfigService.pageResource(query); // 调用service层方法根据resourceId分页获取接口配置列表
|
PageResult<ApiConfigVo> page = apiConfigService.pageResource(query);
|
||||||
return Result.ok(page); // 封装返回结果并返回
|
|
||||||
|
return Result.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@GetMapping("page-auth")
|
||||||
* 根据id获取接口配置信息
|
@Operation(summary = "根据resourceId分页获取")
|
||||||
* @param id 接口配置id
|
public Result<PageResult<ApiConfigVo>> pageAuth(@Valid ApiConfigQuery query) {
|
||||||
* @return 对应id的接口配置信息
|
PageResult<ApiConfigVo> page = apiConfigService.page(query);
|
||||||
*/
|
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@Operation(summary = "根据id获取接口配置信息")
|
@Operation(summary = "信息")
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:info')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:info')")
|
||||||
public Result<ApiConfigVo> get(@PathVariable("id") Long id){
|
public Result<ApiConfigVo> get(@PathVariable("id") Long id){
|
||||||
ApiConfigEntity entity=apiConfigService.getById(id); // 根据id获取接口配置实体对象
|
ApiConfigEntity entity=apiConfigService.getById(id);
|
||||||
return Result.ok(ApiConfigConvert.INSTANCE.convert(entity)); // 封装返回结果并返回
|
return Result.ok(ApiConfigConvert.INSTANCE.convert(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存接口配置信息
|
|
||||||
* @param vo 接口配置信息
|
|
||||||
* @return 保存结果
|
|
||||||
*/
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "保存接口配置信息")
|
@Operation(summary = "保存")
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:save')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:save')")
|
||||||
public Result<String> save(@RequestBody ApiConfigVo vo) {
|
public Result<String> save(@RequestBody ApiConfigVo vo) {
|
||||||
apiConfigService.save(vo); // 调用service层方法保存接口配置信息
|
apiConfigService.save(vo);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改接口配置信息
|
|
||||||
* @param vo 接口配置信息
|
|
||||||
* @return 修改结果
|
|
||||||
*/
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Operation(summary = "修改接口配置信息")
|
@Operation(summary = "修改")
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:update')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:update')")
|
||||||
public Result<String> update(@RequestBody ApiConfigVo vo){
|
public Result<String> update(@RequestBody ApiConfigVo vo){
|
||||||
apiConfigService.update(vo); // 调用service层方法修改接口配置信息
|
apiConfigService.update(vo);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除接口配置信息
|
|
||||||
* @param idList 待删除的接口配置id列表
|
|
||||||
* @return 删除结果
|
|
||||||
*/
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Operation(summary = "删除接口配置信息")
|
@Operation(summary = "删除")
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:delete')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:delete')")
|
||||||
public Result<String> delete(@RequestBody List<Long> idList){
|
public Result<String> delete(@RequestBody List<Long> idList){
|
||||||
apiConfigService.delete(idList); // 调用service层方法删除接口配置信息
|
apiConfigService.delete(idList);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取服务的IP和端口号
|
|
||||||
* @return IP和端口号
|
|
||||||
*/
|
|
||||||
@GetMapping("getIpPort")
|
@GetMapping("getIpPort")
|
||||||
@Operation(summary = "获取服务的IP和端口号")
|
|
||||||
public Result<String> getIpPort() {
|
public Result<String> getIpPort() {
|
||||||
return Result.ok(apiConfigService.getIpPort()); // 封装返回结果并返回
|
return Result.ok(apiConfigService.getIpPort());
|
||||||
}
|
}
|
||||||
|
@Operation(summary = "获取服务的ip和端口号")
|
||||||
/**
|
|
||||||
* 获取服务的IP和端口号
|
|
||||||
* @return IP和端口号
|
|
||||||
*/
|
|
||||||
@GetMapping("/ip-port")
|
@GetMapping("/ip-port")
|
||||||
@Operation(summary = "获取服务的IP和端口号")
|
|
||||||
public Result<String> ipPort() {
|
public Result<String> ipPort() {
|
||||||
return Result.ok(apiConfigService.ipPort()); // 封装返回结果并返回
|
return Result.ok(apiConfigService.ipPort());
|
||||||
}
|
}
|
||||||
|
@Operation(summary = "上线")
|
||||||
/**
|
|
||||||
* 上线指定id的接口配置
|
|
||||||
* @param id 待上线的接口配置id
|
|
||||||
* @return 上线结果
|
|
||||||
*/
|
|
||||||
@PutMapping("/{id}/online")
|
|
||||||
@Operation(summary = "上线指定id的接口配置")
|
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:online')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:online')")
|
||||||
|
@PutMapping("/{id}/online")
|
||||||
public Result<String> online(@PathVariable Long id) {
|
public Result<String> online(@PathVariable Long id) {
|
||||||
apiConfigService.online(id); // 调用service层方法上线指定id的接口配置
|
apiConfigService.online(id);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
@Operation(summary = "下线")
|
||||||
/**
|
|
||||||
* 下线指定id的接口配置
|
|
||||||
* @param id 待下线的接口配置id
|
|
||||||
* @return 下线结果
|
|
||||||
*/
|
|
||||||
@PutMapping("/{id}/offline")
|
|
||||||
@Operation(summary = "下线指定id的接口配置")
|
|
||||||
@PreAuthorize("hasAnyAuthority('data-service:api-config:offline')")
|
@PreAuthorize("hasAnyAuthority('data-service:api-config:offline')")
|
||||||
|
@PutMapping("/{id}/offline")
|
||||||
public Result<String> offline(@PathVariable Long id){
|
public Result<String> offline(@PathVariable Long id){
|
||||||
apiConfigService.offline(id); // 调用service层方法下线指定id的接口配置
|
apiConfigService.offline(id);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Operation(summary = "执行sql")
|
||||||
* 执行SQL查询
|
|
||||||
* @param dto SQL查询参数
|
|
||||||
* @return SQL查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/sql/execute")
|
@PostMapping("/sql/execute")
|
||||||
@Operation(summary = "执行SQL查询")
|
|
||||||
public Result<JdbcSelectResult> sqlExecute(@RequestBody SqlDto dto) {
|
public Result<JdbcSelectResult> sqlExecute(@RequestBody SqlDto dto) {
|
||||||
return Result.ok(apiConfigService.sqlExecute(dto)); // 封装返回结果并返回
|
return Result.ok(apiConfigService.sqlExecute(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Operation(summary = "导出 api 文档")
|
||||||
* 导出指定id列表对应的API文档
|
|
||||||
* @param ids 待导出API文档的id列表
|
|
||||||
* @param response HTTP响应对象
|
|
||||||
*/
|
|
||||||
@PostMapping(value = "/export-docs")
|
@PostMapping(value = "/export-docs")
|
||||||
@Operation(summary = "导出API文档")
|
|
||||||
public void exportDocs(@RequestBody List<Long> ids, HttpServletResponse response) {
|
public void exportDocs(@RequestBody List<Long> ids, HttpServletResponse response) {
|
||||||
apiConfigService.exportDocs(ids, response); // 调用service层方法导出API文档
|
apiConfigService.exportDocs(ids, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,66 +28,42 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ApiGroupController {
|
public class ApiGroupController {
|
||||||
private final ApiGroupService apiGroupService;
|
private final ApiGroupService apiGroupService;
|
||||||
/**
|
@GetMapping
|
||||||
* 查询文件分组树
|
|
||||||
* @return 文件分组树的列表结果
|
|
||||||
*/
|
|
||||||
@GetMapping("api-group")
|
|
||||||
@Operation(summary = "查询文件分组树")
|
@Operation(summary = "查询文件分组树")
|
||||||
public Result<List<TreeNodeVo>> listTree() {
|
public Result<List<TreeNodeVo>> listTree() {
|
||||||
return Result.ok(apiGroupService.listTree()); // 调用service层方法查询文件分组树并返回结果
|
return Result.ok(apiGroupService.listTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id获取文件分组信息
|
|
||||||
* @param id 文件分组id
|
|
||||||
* @return 对应id的文件分组信息
|
|
||||||
*/
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@Operation(summary = "信息")
|
@Operation(summary = "信息")
|
||||||
@PreAuthorize("hasAuthority('data-service:api-group:info')")
|
@PreAuthorize("hasAuthority('data-service:api-group:info')")
|
||||||
public Result<ApiGroupVo> get(@PathVariable("id") Long id){
|
public Result<ApiGroupVo> get(@PathVariable("id") Long id){
|
||||||
ApiGroupEntity entity = apiGroupService.getById(id); // 根据id获取文件分组实体对象
|
ApiGroupEntity entity = apiGroupService.getById(id);
|
||||||
return Result.ok(ApiGroupConvert.INSTANCE.convert(entity)); // 封装返回结果并返回
|
|
||||||
|
return Result.ok(ApiGroupConvert.INSTANCE.convert(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存文件分组信息
|
|
||||||
* @param vo 文件分组信息
|
|
||||||
* @return 保存结果
|
|
||||||
*/
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "保存")
|
@Operation(summary = "保存")
|
||||||
@PreAuthorize("hasAuthority('data-service:api-group:save')")
|
@PreAuthorize("hasAuthority('data-service:api-group:save')")
|
||||||
public Result<String> save(@RequestBody ApiGroupVo vo) {
|
public Result<String> save(@RequestBody ApiGroupVo vo) {
|
||||||
apiGroupService.save(vo); // 调用service层方法保存文件分组信息
|
apiGroupService.save(vo);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改文件分组信息
|
|
||||||
* @param vo 文件分组信息
|
|
||||||
* @return 修改结果
|
|
||||||
*/
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PreAuthorize("hasAuthority('data-service:api-group:update')")
|
@PreAuthorize("hasAuthority('data-service:api-group:update')")
|
||||||
public Result<String> update(@RequestBody @Valid ApiGroupVo vo) {
|
public Result<String> update(@RequestBody @Valid ApiGroupVo vo) {
|
||||||
apiGroupService.update(vo); // 调用service层方法修改文件分组信息
|
apiGroupService.update(vo);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除文件分组信息
|
|
||||||
* @param id 待删除的文件分组id
|
|
||||||
* @return 删除结果
|
|
||||||
*/
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@PreAuthorize("hasAuthority('data-service:api-group:delete')")
|
@PreAuthorize("hasAuthority('data-service:api-group:delete')")
|
||||||
public Result<String> delete(@PathVariable Long id) {
|
public Result<String> delete(@PathVariable Long id) {
|
||||||
apiGroupService.delete(id); // 调用service层方法删除文件分组信息
|
apiGroupService.delete(id);
|
||||||
return Result.ok(); // 封装返回结果并返回
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.dao.DataServiceAppDao;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.service.DataServiceAppService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName : DataServiceApiController
|
||||||
|
* @Description :
|
||||||
|
* @Author : FJJ
|
||||||
|
* @Date: 2023-12-26 20:38
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api")
|
||||||
|
@Tag(name = "api")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DataServiceApiController {
|
||||||
|
private final DataServiceAppService dataServiceAppService;
|
||||||
|
@GetMapping("/token/generate")
|
||||||
|
public Result<String> tokenGenerate(@RequestParam String appKey, @RequestParam String appSecret) {
|
||||||
|
return Result.ok(dataServiceAppService.tokenGenerate(appKey, appSecret));
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,9 @@ import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.query.DataServiceAppQuery;
|
import net.srt.query.DataServiceAppQuery;
|
||||||
import net.srt.service.DataServiceAppService;
|
import net.srt.service.DataServiceAppService;
|
||||||
|
import net.srt.vo.DataServiceApiAuthVo;
|
||||||
import net.srt.vo.DataServiceAppVo;
|
import net.srt.vo.DataServiceAppVo;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
@ -61,16 +63,18 @@ public class DataServiceAppController {
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/auth")
|
@PostMapping("/auth")
|
||||||
@Operation(summary = "添加授权")
|
@Operation(summary = "添加授权")
|
||||||
public Result<String> addAuth(@RequestBody DataServiceAppVo authVO){
|
public Result<String> addAuth(@RequestBody DataServiceApiAuthVo authVO){
|
||||||
dataServiceAppService.addAuth(authVO);
|
dataServiceAppService.addAuth(authVO);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/auth")
|
@PutMapping("/auth")
|
||||||
@Operation(summary = "修改授权")
|
@Operation(summary = "修改授权")
|
||||||
public Result<String> upAuth(@RequestBody DataServiceAppVo authVO){
|
public Result<String> upAuth(@RequestBody DataServiceApiAuthVo authVO){
|
||||||
dataServiceAppService.upAuth(authVO);
|
dataServiceAppService.upAuth(authVO);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,26 @@
|
||||||
package net.srt.convert;
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.entity.DataServiceApiAuthEntity;
|
||||||
|
import net.srt.vo.DataServiceApiAuthVo;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName : DataServiceApiAuthConvert
|
* @ClassName : DataServiceApiAuthConvert
|
||||||
* @Description :
|
* @Description :
|
||||||
* @Author : FJJ
|
* @Author : FJJ
|
||||||
* @Date: 2023-12-26 15:23
|
* @Date: 2023-12-26 19:45
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface DataServiceApiAuthConvert {
|
public interface DataServiceApiAuthConvert {
|
||||||
|
DataServiceApiAuthConvert INSTANCE = Mappers.getMapper(DataServiceApiAuthConvert.class);
|
||||||
|
|
||||||
|
|
||||||
|
DataServiceApiAuthEntity convert(DataServiceApiAuthVo vo);
|
||||||
|
|
||||||
|
DataServiceApiAuthVo convert(DataServiceApiAuthEntity entity);
|
||||||
|
|
||||||
|
List<DataServiceApiAuthVo> convertList(List<DataServiceApiAuthEntity> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public interface DataServiceAppConvert {
|
||||||
|
|
||||||
DataServiceAppEntity convert(DataServiceAppVo vo);
|
DataServiceAppEntity convert(DataServiceAppVo vo);
|
||||||
|
|
||||||
|
|
||||||
DataServiceAppVo convert(DataServiceAppEntity entity);
|
DataServiceAppVo convert(DataServiceAppEntity entity);
|
||||||
|
|
||||||
List<DataServiceAppVo> convertList(List<DataServiceAppEntity> list);
|
List<DataServiceAppVo> convertList(List<DataServiceAppEntity> list);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.srt.dao;
|
||||||
import net.srt.entity.ApiConfigEntity;
|
import net.srt.entity.ApiConfigEntity;
|
||||||
import net.srt.framework.mybatis.dao.BaseDao;
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -12,4 +13,8 @@ public interface ApiConfigDao extends BaseDao<ApiConfigEntity> {
|
||||||
List<ApiConfigEntity> getResourceList(Map<String, Object> params);
|
List<ApiConfigEntity> getResourceList(Map<String, Object> params);
|
||||||
|
|
||||||
ApiConfigEntity getById(Long id);
|
ApiConfigEntity getById(Long id);
|
||||||
|
|
||||||
|
void updateById(@Param("apiId") Long apiId, @Param("id") Long id);
|
||||||
|
|
||||||
|
List<ApiConfigEntity> getAuthList(Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
package net.srt.dao;
|
package net.srt.dao;
|
||||||
|
|
||||||
|
import net.srt.entity.DataServiceApiAuthEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName : DataServiceApiAuthDao
|
* @ClassName : DataServiceApiAuthDao
|
||||||
* @Description :
|
* @Description :
|
||||||
* @Author : FJJ
|
* @Author : FJJ
|
||||||
* @Date: 2023-12-26 15:23
|
* @Date: 2023-12-26 15:23
|
||||||
*/
|
*/
|
||||||
public interface DataServiceApiAuthDao {
|
@Mapper
|
||||||
|
public interface DataServiceApiAuthDao extends BaseDao<DataServiceApiAuthEntity> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,5 @@ import org.apache.ibatis.annotations.Param;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DataServiceAppDao extends BaseDao<DataServiceAppEntity> {
|
public interface DataServiceAppDao extends BaseDao<DataServiceAppEntity> {
|
||||||
DataServiceAppEntity selectByApplyId(@Param("applyId") Long applyId);
|
// DataServiceAppEntity selectByApplyId(@Param("applyId") Long applyId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,164 +12,37 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
public class ApiConfigDto implements Serializable {
|
public class ApiConfigDto implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/**
|
|
||||||
* 数据库主键id
|
|
||||||
*/
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件分组id
|
|
||||||
*/
|
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件路径
|
|
||||||
*/
|
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类型,如:sql、http等
|
|
||||||
*/
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件名称
|
|
||||||
*/
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件备注
|
|
||||||
*/
|
|
||||||
private String note;
|
private String note;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL语句内容
|
|
||||||
*/
|
|
||||||
private String sqlText;
|
private String sqlText;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL语句分隔符
|
|
||||||
*/
|
|
||||||
private String sqlSeparator;
|
private String sqlSeparator;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL最大行数
|
|
||||||
*/
|
|
||||||
private Integer sqlMaxRow;
|
private Integer sqlMaxRow;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL语句参数
|
|
||||||
*/
|
|
||||||
private String sqlParam;
|
private String sqlParam;
|
||||||
|
|
||||||
/**
|
|
||||||
* JSON参数
|
|
||||||
*/
|
|
||||||
private String jsonParam;
|
private String jsonParam;
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP响应结果
|
|
||||||
*/
|
|
||||||
private String responseResult;
|
private String responseResult;
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容类型
|
|
||||||
*/
|
|
||||||
private String contentType;
|
private String contentType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态,1启用,0禁用
|
|
||||||
*/
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布时间
|
|
||||||
*/
|
|
||||||
private Date releaseTime;
|
private Date releaseTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布用户id
|
|
||||||
*/
|
|
||||||
private Long releaseUserId;
|
private Long releaseUserId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据库类型
|
|
||||||
*/
|
|
||||||
private Integer sqlDbType;
|
private Integer sqlDbType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据库id
|
|
||||||
*/
|
|
||||||
private Long databaseId;
|
private Long databaseId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否私有文件,1是,0否
|
|
||||||
*/
|
|
||||||
private Integer privates;
|
private Integer privates;
|
||||||
|
|
||||||
/**
|
|
||||||
* 开启事务,1是,0否
|
|
||||||
*/
|
|
||||||
private Integer openTrans;
|
private Integer openTrans;
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目id
|
|
||||||
*/
|
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 版本号
|
|
||||||
*/
|
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除,1是,0否
|
|
||||||
*/
|
|
||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者id
|
|
||||||
*/
|
|
||||||
private Long creator;
|
private Long creator;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者id
|
|
||||||
*/
|
|
||||||
private Long updater;
|
private Long updater;
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求次数
|
|
||||||
*/
|
|
||||||
private Integer requestedTimes;
|
private Integer requestedTimes;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求成功次数
|
|
||||||
*/
|
|
||||||
private Integer requestedSuccessTimes;
|
private Integer requestedSuccessTimes;
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求失败次数
|
|
||||||
*/
|
|
||||||
private Integer requestedFailedTimes;
|
private Integer requestedFailedTimes;
|
||||||
|
|
||||||
/**
|
|
||||||
* 授权id
|
|
||||||
*/
|
|
||||||
private Long authId;
|
private Long authId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组名
|
|
||||||
*/
|
|
||||||
private String group;
|
private String group;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,24 +10,8 @@ import java.io.Serializable;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class AppToken implements Serializable {
|
public class AppToken implements Serializable {
|
||||||
/**
|
|
||||||
* 应用id
|
|
||||||
*/
|
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用密钥
|
|
||||||
*/
|
|
||||||
private String appKey;
|
private String appKey;
|
||||||
|
|
||||||
/**
|
|
||||||
* 访问令牌
|
|
||||||
*/
|
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
/**
|
|
||||||
* 过期时间戳
|
|
||||||
*/
|
|
||||||
private Long expireAt;
|
private Long expireAt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,44 +4,12 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SqlDto {
|
public class SqlDto {
|
||||||
/**
|
|
||||||
* 数据库类型
|
|
||||||
*/
|
|
||||||
private Integer sqlDbType;
|
private Integer sqlDbType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目id
|
|
||||||
*/
|
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL语句
|
|
||||||
*/
|
|
||||||
private String statement;
|
private String statement;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL语句分隔符
|
|
||||||
*/
|
|
||||||
private String sqlSeparator;
|
private String sqlSeparator;
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据库id
|
|
||||||
*/
|
|
||||||
private Long databaseId;
|
private Long databaseId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启事务,1是,0否
|
|
||||||
*/
|
|
||||||
private Integer openTrans;
|
private Integer openTrans;
|
||||||
|
|
||||||
/**
|
|
||||||
* JSON参数
|
|
||||||
*/
|
|
||||||
private String jsonParams;
|
private String jsonParams;
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL最大行数
|
|
||||||
*/
|
|
||||||
private Integer sqlMaxRow;
|
private Integer sqlMaxRow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
//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 lombok.Data;
|
|
||||||
//import lombok.EqualsAndHashCode;
|
|
||||||
//import net.srt.framework.mybatis.entity.BaseEntity;
|
|
||||||
//
|
|
||||||
//import java.util.Date;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @ClassName : DataServiceApiAuthEnitiy
|
|
||||||
// * @Description :
|
|
||||||
// * @Author : FJJ
|
|
||||||
// * @Date: 2023-12-24 11:30
|
|
||||||
// */
|
|
||||||
//@EqualsAndHashCode(callSuper=false)
|
|
||||||
//@Data
|
|
||||||
//@TableName("data_service_api_auth1")
|
|
||||||
//public class DataServiceApiAuthEnitiy extends BaseEntity {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * app的id
|
|
||||||
// */
|
|
||||||
// private Long appId;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 分组id
|
|
||||||
// */
|
|
||||||
// private Long groupId;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * api的id
|
|
||||||
// */
|
|
||||||
// private Long apiId;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 调用次数 不限次数为-1
|
|
||||||
// */
|
|
||||||
// private Integer requestTimes;
|
|
||||||
//
|
|
||||||
// @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
||||||
// private Date startTime;
|
|
||||||
// @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
||||||
// private Date endTime;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 已调用次数
|
|
||||||
// */
|
|
||||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
|
||||||
// private Integer requestedTimes;
|
|
||||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
|
||||||
// private Integer requestedSuccessTimes;
|
|
||||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
|
||||||
// private Integer requestedFailedTimes;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 所属项目id
|
|
||||||
// */
|
|
||||||
// private Long projectId;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 真删
|
|
||||||
// */
|
|
||||||
// @TableField(fill = FieldFill.INSERT)
|
|
||||||
// private Integer deleted;
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -4,6 +4,7 @@ import net.srt.entity.DataServiceAppEntity;
|
||||||
import net.srt.framework.common.page.PageResult;
|
import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.mybatis.service.BaseService;
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
import net.srt.query.DataServiceAppQuery;
|
import net.srt.query.DataServiceAppQuery;
|
||||||
|
import net.srt.vo.DataServiceApiAuthVo;
|
||||||
import net.srt.vo.DataServiceAppVo;
|
import net.srt.vo.DataServiceAppVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -23,9 +24,11 @@ public interface DataServiceAppService extends BaseService<DataServiceAppEntity>
|
||||||
|
|
||||||
void delete(List<Long> idList);
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
void addAuth(DataServiceAppVo authVO);
|
void addAuth(DataServiceApiAuthVo authVO);
|
||||||
|
|
||||||
void upAuth(DataServiceAppVo authVO);
|
void upAuth(DataServiceApiAuthVo authVO);
|
||||||
|
|
||||||
void cancelAuth(Long authId);
|
void cancelAuth(Long authId);
|
||||||
|
|
||||||
|
String tokenGenerate(String appKey, String appSecret);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,6 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
private final DiscoveryClient discoveryClient;
|
private final DiscoveryClient discoveryClient;
|
||||||
private final ApiConfigDao apiConfigDao;
|
private final ApiConfigDao apiConfigDao;
|
||||||
private final Map<String, ApiConfigEntity> mappings = new ConcurrentHashMap<>();
|
private final Map<String, ApiConfigEntity> mappings = new ConcurrentHashMap<>();
|
||||||
/**
|
|
||||||
* 获取服务实例的IP和端口
|
|
||||||
* @return IP和端口
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getIpPort() {
|
public String getIpPort() {
|
||||||
List<ServiceInstance> instances = discoveryClient.getInstances(ServerNames.GATEWAY_SERVER_NAME);
|
List<ServiceInstance> instances = discoveryClient.getInstances(ServerNames.GATEWAY_SERVER_NAME);
|
||||||
|
@ -55,10 +51,7 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将API配置设置为上线状态并更新路由映射
|
|
||||||
* @param id API配置ID
|
|
||||||
*/
|
|
||||||
public void online(Long id) {
|
public void online(Long id) {
|
||||||
ApiConfigEntity apiConfigEntity = apiConfigDao.getById(id);
|
ApiConfigEntity apiConfigEntity = apiConfigDao.getById(id);
|
||||||
if (apiConfigEntity != null) {
|
if (apiConfigEntity != null) {
|
||||||
|
@ -100,41 +93,36 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
private String getRouteKey(String type, String path) {
|
private String getRouteKey(String type, String path) {
|
||||||
return type.toUpperCase() + "_" + path.toLowerCase();
|
return type.toUpperCase() + "_" + path.toLowerCase();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 将API配置设置为下线状态
|
|
||||||
* @param id API配置ID
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void offline(Long id) {
|
public void offline(Long id) { // 修正参数类型为 Long id
|
||||||
// 根据id获取API配置实体对象
|
|
||||||
ApiConfigEntity apiConfigEntity = apiConfigDao.getById(id);
|
ApiConfigEntity apiConfigEntity = apiConfigDao.getById(id);
|
||||||
if (apiConfigEntity != null) {
|
if (apiConfigEntity != null) {
|
||||||
// 将API配置实体对象的状态设置为下线
|
|
||||||
apiConfigEntity.setStatus(0);
|
apiConfigEntity.setStatus(0);
|
||||||
apiConfigEntity.setReleaseTime(null);
|
apiConfigEntity.setReleaseTime(null);
|
||||||
apiConfigEntity.setReleaseUserId(null);
|
apiConfigEntity.setReleaseUserId(null);
|
||||||
// 更新API配置实体对象
|
|
||||||
apiConfigDao.updateById(apiConfigEntity);
|
apiConfigDao.updateById(apiConfigEntity);
|
||||||
} else {
|
}else{
|
||||||
// 如果没有找到对应的API配置实体对象,抛出404异常
|
|
||||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Resource not found");
|
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Resource not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// @Override
|
||||||
|
// public void online(Long id) {
|
||||||
|
// ApiConfigEntity apiConfigEntity = new ApiConfigEntity();
|
||||||
|
// apiConfigEntity.setId(id);
|
||||||
|
// apiConfigEntity.setStatus(1);
|
||||||
|
// apiConfigEntity.setReleaseTime(new Date());
|
||||||
|
// apiConfigEntity.setReleaseUserId(SecurityUser.getUserId());
|
||||||
|
//
|
||||||
|
// apiConfigDao.updateById(apiConfigEntity);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取服务实例的IP和端口
|
|
||||||
* @return IP和端口
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String ipPort() {
|
public String ipPort() {
|
||||||
// 获取网关服务实例列表
|
|
||||||
List<ServiceInstance> instances = discoveryClient.getInstances(ServerNames.GATEWAY_SERVER_NAME);
|
List<ServiceInstance> instances = discoveryClient.getInstances(ServerNames.GATEWAY_SERVER_NAME);
|
||||||
// 获取第一个网关服务实例的主机和端口,并返回拼接后的字符串
|
|
||||||
return instances.get(0).getHost() + ":" + instances.get(0).getPort();
|
return instances.get(0).getHost() + ":" + instances.get(0).getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JdbcSelectResult sqlExecute(SqlDto dto) {
|
public JdbcSelectResult sqlExecute(SqlDto dto) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -180,21 +168,18 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询API配置
|
|
||||||
* @param query 查询条件
|
|
||||||
* @return API配置分页结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ApiConfigVo> page(ApiConfigQuery query) {
|
public PageResult<ApiConfigVo> page(ApiConfigQuery query) {
|
||||||
// 执行分页查询,并获取分页对象
|
// 查询参数
|
||||||
IPage<ApiConfigEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
Map<String, Object> params = getParams(query);
|
||||||
// 将实体对象列表转换为VO对象列表
|
// 分页查询
|
||||||
List<ApiConfigVo> apiConfigVos = ApiConfigConvert.INSTANCE.convertList(page.getRecords());
|
query.setOrder("dsac.id");
|
||||||
// 返回VO对象列表和总记录数构成的分页结果对象
|
IPage<ApiConfigEntity> page = getPage(query);
|
||||||
return new PageResult<>(apiConfigVos, page.getTotal());
|
params.put(Constant.PAGE, page);
|
||||||
|
// 数据列表
|
||||||
|
List<ApiConfigEntity> list = baseMapper.getAuthList(params);
|
||||||
|
return new PageResult<>(ApiConfigConvert.INSTANCE.convertList(list), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper getWrapper(ApiConfigQuery query) {
|
private LambdaQueryWrapper getWrapper(ApiConfigQuery query) {
|
||||||
LambdaQueryWrapper<ApiConfigEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<ApiConfigEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
wrapper.like(StringUtil.isNotBlank(query.getName()), ApiConfigEntity::getName, query.getName());
|
wrapper.like(StringUtil.isNotBlank(query.getName()), ApiConfigEntity::getName, query.getName());
|
||||||
|
@ -211,32 +196,17 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增API配置
|
|
||||||
* @param vo API配置VO对象
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void save(ApiConfigVo vo) {
|
public void save(ApiConfigVo vo) {
|
||||||
// 将VO对象转换为实体对象
|
|
||||||
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
||||||
// 设置项目ID
|
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
// 执行插入操作
|
|
||||||
baseMapper.insert(entity);
|
baseMapper.insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新API配置
|
|
||||||
* @param vo API配置VO对象
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void update(ApiConfigVo vo) {
|
public void update(ApiConfigVo vo) {
|
||||||
// 将VO对象转换为实体对象
|
|
||||||
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
||||||
// 设置项目ID
|
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
// 执行更新操作
|
|
||||||
updateById(entity);
|
updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,52 +215,31 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
||||||
removeByIds(idList);
|
removeByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询API资源
|
|
||||||
* @param query 查询条件
|
|
||||||
* @return API资源分页结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ApiConfigVo> pageResource(ApiConfigQuery query) {
|
public PageResult<ApiConfigVo> pageResource(ApiConfigQuery query) {
|
||||||
// 获取查询参数
|
// 查询参数
|
||||||
Map<String, Object> params = getParams(query);
|
Map<String, Object> params = getParams(query);
|
||||||
// 获取分页对象
|
|
||||||
IPage<ApiConfigEntity> page = getPage(query);
|
IPage<ApiConfigEntity> page = getPage(query);
|
||||||
params.put(Constant.PAGE, page);
|
params.put(Constant.PAGE, page);
|
||||||
// 查询数据列表
|
// 数据列表
|
||||||
List<ApiConfigEntity> list = baseMapper.getResourceList(params);
|
List<ApiConfigEntity> list = baseMapper.getResourceList(params);
|
||||||
// 将数据列表转换为VO对象列表
|
|
||||||
List<ApiConfigVo> apiConfigVos = ApiConfigConvert.INSTANCE.convertList(list);
|
List<ApiConfigVo> apiConfigVos = ApiConfigConvert.INSTANCE.convertList(list);
|
||||||
// 遍历VO对象列表,设置所属组信息
|
|
||||||
for (ApiConfigVo apiConfigVo : apiConfigVos) {
|
for (ApiConfigVo apiConfigVo : apiConfigVos) {
|
||||||
ApiGroupEntity groupEntity = apiGroupDao.selectById(apiConfigVo.getGroupId());
|
ApiGroupEntity groupEntity = apiGroupDao.selectById(apiConfigVo.getGroupId());
|
||||||
apiConfigVo.setGroup(groupEntity != null ? groupEntity.getPath() : null);
|
apiConfigVo.setGroup(groupEntity != null ? groupEntity.getPath() : null);
|
||||||
}
|
}
|
||||||
// 返回VO对象列表和总记录数构成的分页结果对象
|
|
||||||
return new PageResult<>(apiConfigVos, page.getTotal());
|
return new PageResult<>(apiConfigVos, page.getTotal());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据组ID获取有效的API配置列表
|
|
||||||
* @param id 组ID
|
|
||||||
* @return API配置列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<ApiConfigEntity> listActiveByGroupId(Long id) {
|
public List<ApiConfigEntity> listActiveByGroupId(Long id) {
|
||||||
// 创建LambdaQueryWrapper对象
|
|
||||||
LambdaQueryWrapper<ApiConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ApiConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
// 设置查询条件:状态为1(有效),组ID为指定ID,并按照ID降序排序
|
wrapper.eq(ApiConfigEntity::getStatus, 1).eq(ApiConfigEntity::getGroupId, id).orderByDesc(ApiConfigEntity::getId);
|
||||||
wrapper.eq(ApiConfigEntity::getStatus, 1)
|
|
||||||
.eq(ApiConfigEntity::getGroupId, id)
|
|
||||||
.orderByDesc(ApiConfigEntity::getId);
|
|
||||||
// 应用数据范围控制(排除组织ID)
|
|
||||||
dataScopeWithoutOrgId(wrapper);
|
dataScopeWithoutOrgId(wrapper);
|
||||||
// 执行查询并返回结果列表
|
|
||||||
return baseMapper.selectList(wrapper);
|
return baseMapper.selectList(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<String, Object> getParams(ApiConfigQuery query) {
|
private Map<String, Object> getParams(ApiConfigQuery query) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("ifMarket", query.getIfMarket());
|
params.put("ifMarket", query.getIfMarket());
|
||||||
|
|
|
@ -25,78 +25,43 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEntity> implements ApiGroupService{
|
public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEntity> implements ApiGroupService{
|
||||||
private final ApiConfigService apiConfigService;
|
private final ApiConfigService apiConfigService;
|
||||||
/**
|
|
||||||
* 获取API分组树形结构列表
|
|
||||||
* @return API分组树形结构列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeNodeVo> listTree() {
|
public List<TreeNodeVo> listTree() {
|
||||||
// 查询所有API分组实体对象,并转换为树节点VO对象列表
|
|
||||||
List<TreeNodeVo> treeNodeVos = getTreeNodeVos();
|
List<TreeNodeVo> treeNodeVos = getTreeNodeVos();
|
||||||
// 构建树形结构,并返回根节点列表
|
|
||||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取API分组树节点VO对象列表
|
|
||||||
* @return API分组树节点VO对象列表
|
|
||||||
*/
|
|
||||||
private List<TreeNodeVo> getTreeNodeVos() {
|
private List<TreeNodeVo> getTreeNodeVos() {
|
||||||
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
dataScopeWithoutOrgId(wrapper); // 加入数据权限过滤
|
dataScopeWithoutOrgId(wrapper);
|
||||||
wrapper.orderByAsc(ApiGroupEntity::getOrderNo); // 按orderNo升序排序
|
wrapper.orderByAsc(ApiGroupEntity::getOrderNo);
|
||||||
List<ApiGroupEntity> apiGroupEntities = baseMapper.selectList(wrapper);
|
List<ApiGroupEntity> apiGroupEntities = baseMapper.selectList(wrapper);
|
||||||
// 将实体对象列表转换为VO对象列表
|
|
||||||
return BeanUtil.copyListProperties(apiGroupEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
return BeanUtil.copyListProperties(apiGroupEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
// 设置节点名称
|
|
||||||
newItem.setLabel(oldItem.getName());
|
newItem.setLabel(oldItem.getName());
|
||||||
// 设置节点值
|
|
||||||
newItem.setValue(oldItem.getId());
|
newItem.setValue(oldItem.getId());
|
||||||
newItem.setDisabled(oldItem.getType() == 1); // 如果是虚拟节点,设置禁用状态
|
newItem.setDisabled(oldItem.getType() == 1);
|
||||||
if (newItem.getPath().contains("/")) { // 设置父级节点路径
|
if (newItem.getPath().contains("/")) {
|
||||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增API分组
|
|
||||||
* @param vo API分组VO对象
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void save(ApiGroupVo vo) {
|
public void save(ApiGroupVo vo) {
|
||||||
// 将VO对象转换为实体对象
|
|
||||||
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||||
// 递归生成路径
|
|
||||||
entity.setPath(recursionPath(entity, null));
|
entity.setPath(recursionPath(entity, null));
|
||||||
// 设置项目ID
|
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
// 执行插入操作
|
|
||||||
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新API分组
|
|
||||||
* @param vo API分组VO对象
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void update(ApiGroupVo vo) {
|
public void update(ApiGroupVo vo) {
|
||||||
// 将VO对象转换为实体对象
|
|
||||||
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||||
// 递归生成路径
|
|
||||||
entity.setPath(recursionPath(entity, null));
|
entity.setPath(recursionPath(entity, null));
|
||||||
// 设置项目ID
|
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
// 执行更新操作
|
|
||||||
updateById(entity);
|
updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 递归生成API分组路径
|
|
||||||
* @param groupEntity 分组实体对象
|
|
||||||
* @param path 父级路径
|
|
||||||
* @return 完整路径
|
|
||||||
*/
|
|
||||||
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
||||||
if (StringUtil.isBlank(path)) {
|
if (StringUtil.isBlank(path)) {
|
||||||
path = groupEntity.getName();
|
path = groupEntity.getName();
|
||||||
|
@ -109,28 +74,22 @@ public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEn
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID删除API分组
|
|
||||||
* @param id API分组ID
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
// 查询是否存在子节点
|
//查询有没有子节点
|
||||||
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ApiGroupEntity::getParentId, id).last(" limit 1");
|
wrapper.eq(ApiGroupEntity::getParentId, id).last(" limit 1");
|
||||||
ApiGroupEntity one = baseMapper.selectOne(wrapper);
|
ApiGroupEntity one = baseMapper.selectOne(wrapper);
|
||||||
if (one != null) {
|
if (one != null) {
|
||||||
throw new ServerException("存在子节点,不允许删除!");
|
throw new ServerException("存在子节点,不允许删除!");
|
||||||
}
|
}
|
||||||
// 查询是否有API配置与之关联
|
//查询有没有api与之关联
|
||||||
LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
||||||
serviceApiConfigWrapper.eq(ApiConfigEntity::getGroupId, id).last(" limit 1");
|
serviceApiConfigWrapper.eq(ApiConfigEntity::getGroupId, id).last(" limit 1");
|
||||||
ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
||||||
if (apiConfigEntity != null) {
|
if (apiConfigEntity != null) {
|
||||||
throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
||||||
}
|
}
|
||||||
// 执行删除操作
|
|
||||||
removeById(id);
|
removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.DataServiceApiAuthConvert;
|
||||||
import net.srt.convert.DataServiceAppConvert;
|
import net.srt.convert.DataServiceAppConvert;
|
||||||
|
import net.srt.dao.ApiConfigDao;
|
||||||
|
import net.srt.dao.DataServiceApiAuthDao;
|
||||||
import net.srt.dao.DataServiceAppDao;
|
import net.srt.dao.DataServiceAppDao;
|
||||||
|
import net.srt.dto.AppToken;
|
||||||
|
import net.srt.entity.DataServiceApiAuthEntity;
|
||||||
import net.srt.entity.DataServiceAppEntity;
|
import net.srt.entity.DataServiceAppEntity;
|
||||||
import net.srt.framework.common.exception.ServerException;
|
import net.srt.framework.common.exception.ServerException;
|
||||||
import net.srt.framework.common.page.PageResult;
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
@ -13,7 +18,9 @@ import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.srt.framework.security.user.SecurityUser;
|
import net.srt.framework.security.user.SecurityUser;
|
||||||
import net.srt.query.DataServiceAppQuery;
|
import net.srt.query.DataServiceAppQuery;
|
||||||
import net.srt.service.DataServiceAppService;
|
import net.srt.service.DataServiceAppService;
|
||||||
|
import net.srt.vo.DataServiceApiAuthVo;
|
||||||
import net.srt.vo.DataServiceAppVo;
|
import net.srt.vo.DataServiceAppVo;
|
||||||
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
@ -30,6 +37,8 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceAppEntity> implements DataServiceAppService {
|
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceAppEntity> implements DataServiceAppService {
|
||||||
private final DataServiceAppDao dataServiceAppDao;
|
private final DataServiceAppDao dataServiceAppDao;
|
||||||
|
private final ApiConfigDao apiConfigDao;
|
||||||
|
private final DataServiceApiAuthDao dataServiceApiAuthDao;
|
||||||
@Override
|
@Override
|
||||||
public PageResult<DataServiceAppVo> page(DataServiceAppQuery query) {
|
public PageResult<DataServiceAppVo> page(DataServiceAppQuery query) {
|
||||||
IPage<DataServiceAppEntity> page=baseMapper.selectPage(getPage(query),null);
|
IPage<DataServiceAppEntity> page=baseMapper.selectPage(getPage(query),null);
|
||||||
|
@ -56,14 +65,18 @@ public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAuth(DataServiceAppVo authVO) {
|
public void addAuth(DataServiceApiAuthVo authVO) {
|
||||||
authVO.setProjectId(getProjectId());
|
authVO.setProjectId(getProjectId());
|
||||||
dataServiceAppDao.insert(DataServiceAppConvert.INSTANCE.convert(authVO));
|
DataServiceApiAuthEntity entity = DataServiceApiAuthConvert.INSTANCE.convert(authVO);
|
||||||
|
dataServiceApiAuthDao.insert(entity);
|
||||||
|
Long id = entity.getId();
|
||||||
|
apiConfigDao.updateById(authVO.getApiId(),id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void upAuth(DataServiceAppVo authVO) {
|
public void upAuth(DataServiceApiAuthVo authVO) {
|
||||||
dataServiceAppDao.updateById(DataServiceAppConvert.INSTANCE.convert(authVO));
|
dataServiceApiAuthDao.updateById(DataServiceApiAuthConvert.INSTANCE.convert(authVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,14 +84,42 @@ public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao
|
||||||
dataServiceAppDao.deleteById(authId);
|
dataServiceAppDao.deleteById(authId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String tokenGenerate(String appKey, String appSecret) {
|
||||||
|
LambdaQueryWrapper<DataServiceAppEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(DataServiceAppEntity::getAppKey,appKey).last("limit 1");
|
||||||
|
DataServiceAppEntity dataServiceAppEntity = baseMapper.selectOne(wrapper);
|
||||||
|
if (dataServiceAppEntity==null){
|
||||||
|
throw new RuntimeException("appKey不存在");
|
||||||
|
}
|
||||||
|
if (!appSecret.equals(dataServiceAppEntity.getAppSecret())){
|
||||||
|
throw new ServerException("appSecret错误");
|
||||||
|
}
|
||||||
|
//生成token
|
||||||
|
String token = RandomStringUtils.random(32, true, true);
|
||||||
|
AppToken appToken = new AppToken();
|
||||||
|
appToken.setToken(token);
|
||||||
|
appToken.setAppKey(appKey);
|
||||||
|
appToken.setAppId(dataServiceAppEntity.getId());
|
||||||
|
if (dataServiceAppEntity.getExpireDuration()==0){
|
||||||
|
appToken.setExpireAt(0L);
|
||||||
|
} else if (dataServiceAppEntity.getExpireDuration()== -1) {
|
||||||
|
appToken.setExpireAt(-1L);
|
||||||
|
}else if (dataServiceAppEntity.getExpireDuration()>0){
|
||||||
|
long l = System.currentTimeMillis() + dataServiceAppEntity.getExpireDuration() * 1000;
|
||||||
|
appToken.setExpireAt(l);
|
||||||
|
}
|
||||||
|
return appToken.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
// private LambdaQueryWrapper<DataServiceAppEntity> getWrapper(DataServiceAppQuery query) {
|
|
||||||
// LambdaQueryWrapper<DataServiceAppEntity> wrapper = Wrappers.lambdaQuery();
|
private LambdaQueryWrapper<DataServiceAppEntity> getWrapper(DataServiceAppQuery query) {
|
||||||
// wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceAppEntity::getName, query.getName())
|
LambdaQueryWrapper<DataServiceAppEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
// .eq(DataServiceAppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceAppEntity::getName, query.getName())
|
||||||
// .eq(query.getIfMarket() != null, DataServiceAppEntity::getCreator, SecurityUser.getUserId())
|
.eq(DataServiceAppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
||||||
// .eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceAppEntity::getAppKey, query.getAppKey())
|
.eq(query.getIfMarket() != null, DataServiceAppEntity::getCreator, SecurityUser.getUserId())
|
||||||
// .orderByDesc(DataServiceAppEntity::getCreateTime).orderByDesc(DataServiceAppEntity::getId);
|
.eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceAppEntity::getAppKey, query.getAppKey())
|
||||||
// return wrapper;
|
.orderByDesc(DataServiceAppEntity::getCreateTime).orderByDesc(DataServiceAppEntity::getId);
|
||||||
// }
|
return wrapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
package net.srt.utils;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import java.security.Key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName : EncrypDES
|
||||||
|
* @Description :
|
||||||
|
* @Author : FJJ
|
||||||
|
* @Date: 2023-12-25 09:31
|
||||||
|
*/
|
||||||
|
public class EncrypDES {
|
||||||
|
|
||||||
|
// 字符串默认键值
|
||||||
|
private static String strDefaultKey = "inventec2020@#$%^&";
|
||||||
|
|
||||||
|
//加密工具
|
||||||
|
private Cipher encryptCipher = null;
|
||||||
|
|
||||||
|
// 解密工具
|
||||||
|
private Cipher decryptCipher = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认构造方法,使用默认密钥
|
||||||
|
*/
|
||||||
|
public EncrypDES() throws Exception {
|
||||||
|
this(strDefaultKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定密钥构造方法
|
||||||
|
* @param strKey 指定的密钥
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
|
||||||
|
public EncrypDES(String strKey) throws Exception {
|
||||||
|
|
||||||
|
// Security.addProvider(new com.sun.crypto.provider.SunJCE());
|
||||||
|
Key key = getKey(strKey.getBytes());
|
||||||
|
encryptCipher = Cipher.getInstance("DES");
|
||||||
|
encryptCipher.init(Cipher.ENCRYPT_MODE, key);
|
||||||
|
decryptCipher = Cipher.getInstance("DES");
|
||||||
|
decryptCipher.init(Cipher.DECRYPT_MODE, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将byte数组转换为表示16进制值的字符串, 如:byte[]{8,18}转换为:0813,和public static byte[]
|
||||||
|
*
|
||||||
|
* hexStr2ByteArr(String strIn) 互为可逆的转换过程
|
||||||
|
*
|
||||||
|
* @param arrB 需要转换的byte数组
|
||||||
|
* @return 转换后的字符串
|
||||||
|
* @throws Exception 本方法不处理任何异常,所有异常全部抛出
|
||||||
|
*/
|
||||||
|
public static String byteArr2HexStr(byte[] arrB) throws Exception {
|
||||||
|
int iLen = arrB.length;
|
||||||
|
// 每个byte用2个字符才能表示,所以字符串的长度是数组长度的2倍
|
||||||
|
StringBuffer sb = new StringBuffer(iLen * 2);
|
||||||
|
for (int i = 0; i < iLen; i++) {
|
||||||
|
int intTmp = arrB[i];
|
||||||
|
// 把负数转换为正数
|
||||||
|
while (intTmp < 0) {
|
||||||
|
intTmp = intTmp + 256;
|
||||||
|
}
|
||||||
|
// 小于0F的数需要在前面补0
|
||||||
|
if (intTmp < 16) {
|
||||||
|
sb.append("0");
|
||||||
|
}
|
||||||
|
sb.append(Integer.toString(intTmp, 16));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将表示16进制值的字符串转换为byte数组,和public static String byteArr2HexStr(byte[] arrB)
|
||||||
|
* 互为可逆的转换过程
|
||||||
|
* @param strIn 需要转换的字符串
|
||||||
|
* @return 转换后的byte数组
|
||||||
|
*/
|
||||||
|
public static byte[] hexStr2ByteArr(String strIn) throws Exception {
|
||||||
|
byte[] arrB = strIn.getBytes();
|
||||||
|
int iLen = arrB.length;
|
||||||
|
// 两个字符表示一个字节,所以字节数组长度是字符串长度除以2
|
||||||
|
byte[] arrOut = new byte[iLen / 2];
|
||||||
|
for (int i = 0; i < iLen; i = i + 2) {
|
||||||
|
String strTmp = new String(arrB, i, 2);
|
||||||
|
arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);
|
||||||
|
}
|
||||||
|
return arrOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 加密字节数组
|
||||||
|
* @param arrB 需加密的字节数组
|
||||||
|
* @return 加密后的字节数组
|
||||||
|
*/
|
||||||
|
public byte[] encrypt(byte[] arrB) throws Exception {
|
||||||
|
return encryptCipher.doFinal(arrB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密字符串
|
||||||
|
* @param strIn 需加密的字符串
|
||||||
|
* @return 加密后的字符串
|
||||||
|
*/
|
||||||
|
public String encrypt(String strIn) throws Exception {
|
||||||
|
return byteArr2HexStr(encrypt(strIn.getBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密字节数组
|
||||||
|
* @param arrB 需解密的字节数组
|
||||||
|
* @return 解密后的字节数组
|
||||||
|
*/
|
||||||
|
public byte[] decrypt(byte[] arrB) throws Exception {
|
||||||
|
return decryptCipher.doFinal(arrB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密字符串
|
||||||
|
* @param strIn 需解密的字符串
|
||||||
|
* @return 解密后的字符串
|
||||||
|
*/
|
||||||
|
public String decrypt(String strIn) throws Exception {
|
||||||
|
return new String(decrypt(hexStr2ByteArr(strIn)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从指定字符串生成密钥,密钥所需的字节数组长度为8位 不足8位时后面补0,超出8位只取前8位
|
||||||
|
* @param arrBTmp 构成该字符串的字节数组
|
||||||
|
* @return 生成的密钥
|
||||||
|
*/
|
||||||
|
private Key getKey(byte[] arrBTmp) throws Exception {
|
||||||
|
// 创建一个空的8位字节数组(默认值为0)
|
||||||
|
byte[] arrB = new byte[8];
|
||||||
|
// 将原始字节数组转换为8位
|
||||||
|
for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
|
||||||
|
arrB[i] = arrBTmp[i];
|
||||||
|
}
|
||||||
|
// 生成密钥
|
||||||
|
Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,8 @@ public class DataServiceApiAuthVo implements Serializable {
|
||||||
@Schema(description = "所属项目id")
|
@Schema(description = "所属项目id")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
private Long authId;
|
||||||
|
|
||||||
@Schema(description = "版本号")
|
@Schema(description = "版本号")
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="net.srt.dao.ApiConfigDao">
|
<mapper namespace="net.srt.dao.ApiConfigDao">
|
||||||
|
<update id="updateById">
|
||||||
|
update data_service_api_config set auth_id=#{apiId} where id=#{id}
|
||||||
|
</update>
|
||||||
<select id="getResourceList" resultType="net.srt.entity.ApiConfigEntity">
|
<select id="getResourceList" resultType="net.srt.entity.ApiConfigEntity">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="queryApply!=null and queryApply==1">
|
<when test="queryApply!=null and queryApply==1">
|
||||||
|
@ -25,4 +28,60 @@
|
||||||
<select id="getById" resultType="net.srt.entity.ApiConfigEntity">
|
<select id="getById" resultType="net.srt.entity.ApiConfigEntity">
|
||||||
SELECT * FROM data_service_api_config WHERE id = #{id}
|
SELECT * FROM data_service_api_config WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAuthList" resultType="net.srt.entity.ApiConfigEntity">
|
||||||
|
<choose>
|
||||||
|
<when test="ifMarket != null and ifMarket==1">
|
||||||
|
SELECT
|
||||||
|
dsac.*,
|
||||||
|
dsaa.id AS auth_id,
|
||||||
|
dsag.path AS group_path
|
||||||
|
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
|
||||||
|
WHERE
|
||||||
|
dsaa.app_id=#{appId}
|
||||||
|
AND dsac.deleted=0
|
||||||
|
AND dsaa.deleted=0
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
SELECT
|
||||||
|
dsac.*,
|
||||||
|
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}
|
||||||
|
AND dsaa.deleted=0
|
||||||
|
WHERE
|
||||||
|
dsac.group_id = #{groupId}
|
||||||
|
AND dsac.previlege=1
|
||||||
|
AND dsac.deleted=0
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<if test="name != null and name.trim() != ''">
|
||||||
|
AND dsac.name LIKE "%"#{name}"%"
|
||||||
|
</if>
|
||||||
|
<if test="path != null and path.trim() != ''">
|
||||||
|
AND dsac.path LIKE "%"#{path}"%"
|
||||||
|
</if>
|
||||||
|
<if test="contentType != null and contentType.trim() != ''">
|
||||||
|
AND dsac.content_type = #{contentType}
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND dsac.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="sqlDbType != null">
|
||||||
|
AND dsac.sql_db_type = #{sqlDbType}
|
||||||
|
</if>
|
||||||
|
<if test="databaseId != null">
|
||||||
|
AND dsac.database_id = #{databaseId}
|
||||||
|
</if>
|
||||||
|
<if test="previlege != null">
|
||||||
|
AND dsac.previlege = #{previlege}
|
||||||
|
</if>
|
||||||
|
<if test="openTrans != null">
|
||||||
|
AND dsac.open_trans = #{openTrans}
|
||||||
|
</if>
|
||||||
|
ORDER BY dsac.create_time DESC,dsac.id DESC
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<mapper namespace="net.srt.dao.DataServiceAppDao">
|
<mapper namespace="net.srt.dao.DataServiceAppDao">
|
||||||
|
|
||||||
|
|
||||||
<select id="selectByApplyId" resultType="net.srt.entity.DataServiceAppEntity">
|
<!-- <select id="selectByApplyId" resultType="net.srt.entity.DataServiceAppEntity">-->
|
||||||
SELECT dsa.* FROM data_service_app dsa INNER JOIN data_market_resource_apply dmra ON dsa.id=dmra.app_id WHERE dmra.id=#{applyId}
|
<!-- SELECT dsa.* FROM data_service_app dsa INNER JOIN data_market_resource_apply dmra ON dsa.id=dmra.app_id WHERE dmra.id=#{applyId}-->
|
||||||
</select>
|
<!-- </select>-->
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue