package com.se.nsl.controller;
|
|
|
import com.se.nsl.domain.EntityTypeInfo;
|
import com.se.nsl.domain.LoginParams;
|
import com.se.nsl.domain.vo.R;
|
import com.se.nsl.service.ProjectRelatedService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
@Api(tags = "实体库相关接口")
|
@CrossOrigin(origins = "*")
|
@RequiredArgsConstructor
|
@RestController
|
@RequestMapping("/api/v1")
|
public class ProjectRelatedController extends BaseController {
|
|
@Resource
|
private ProjectRelatedService projectRelatedService;
|
|
|
/**
|
* 获取公钥
|
*
|
* @Cacheable 添加缓存,相同条件的查询不再查询数据库,而是从缓存中查询;
|
* @CachePut 每次都会访问数据库,并更新缓存;
|
* @CacheEvict 清除缓存
|
* <p>
|
* 注解中参数说明:
|
* cacheNames/value:指定缓存组件的名字;
|
* key:缓存数据使用的key;可以用它来指定。默认是使用方法参数的值 1-方法全参 2-方法参数的某几个 3-key(SpEL)
|
* keyGenerator:key的生成器;可以自己指定key的生成器的组件id
|
* cacheManager:指定缓存管理器;或者cacheResolver指定获取解析器
|
* condition:指定符合条件的情况下才缓存;
|
* unless:否定缓存;当unless指定的条件为true,方法的返回值就不会被缓存;可以获取到结果进行判断
|
* sync:是否使用异步模式
|
*/
|
@ApiOperation("0-获取公钥")
|
// @Cacheable(cacheNames="api",value="cachespace=30", key = "#root.methodName")
|
@GetMapping("/get-public-key")
|
public Object getPublicKey() {
|
return projectRelatedService.getPublicKey();
|
}
|
|
/**
|
* 登录实体库
|
*/
|
@ApiOperation("1-登录实体库")
|
// @Cacheable(cacheNames = "api", key = "#loginParams")
|
@PostMapping("/login-entity")
|
public R<Object> loginEntity(@RequestBody LoginParams loginParams) {
|
return success(projectRelatedService.loginEntity(loginParams));
|
}
|
|
|
/**
|
* 获取访问实体库的token
|
*/
|
@ApiOperation("1-获取访问实体库的token")
|
@GetMapping("/entity-public-key")
|
public R<Object> getEntityPublicKey() {
|
return success(projectRelatedService.getEntityPublicKey());
|
}
|
|
|
/**
|
* 获取访问实体库数据库列表
|
*/
|
@ApiOperation("2-获取访问实体库数据库列表")
|
@GetMapping("/db-list")
|
public R<Object> getDbLits() {
|
return success(projectRelatedService.getDbLits());
|
}
|
|
/**
|
* 查询实体库不同类型的信息
|
*/
|
@ApiOperation("3-查询实体库不同类型的信息")
|
@GetMapping("/entity-type-info")
|
public Object getEntityTypeInfo(EntityTypeInfo entityTypeInfo) {
|
return projectRelatedService.getEntityTypeInfo(entityTypeInfo);
|
}
|
|
/**
|
* 查询实体库不同类型的信息
|
*/
|
@ApiOperation("4-查询实体库不同类型的信息-管线")
|
@GetMapping("/entity-pipe-info")
|
public Object getEntityPipeInfo(EntityTypeInfo entityTypeInfo) {
|
return projectRelatedService.getEntityPipeInfo(entityTypeInfo);
|
}
|
|
|
}
|