对称密钥管理
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package com.sunyard.chsm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.KeyInfoDTO;
|
||||
import com.sunyard.chsm.enums.KeyCategory;
|
||||
import com.sunyard.chsm.enums.KeyStatus;
|
||||
import com.sunyard.chsm.model.Option;
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.service.KeyInfoService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -10,6 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 对称密钥管理接口
|
||||
@@ -24,6 +32,31 @@ public class SymKeyController {
|
||||
@Resource
|
||||
private KeyInfoService keyInfoService;
|
||||
|
||||
/**
|
||||
* 获取密钥状态列表
|
||||
*/
|
||||
@GetMapping("/statusList")
|
||||
public R<List<Option>> getStatusList() {
|
||||
|
||||
List<Option> options = Arrays.stream(KeyStatus.values())
|
||||
.map(it -> new Option(it.getCode(), it.getDesc()))
|
||||
.collect(Collectors.toList());
|
||||
return R.data(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询对称密钥列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 分页列表
|
||||
*/
|
||||
@GetMapping("/pageList")
|
||||
public R<Page<KeyInfoDTO.View>> servicePageList(KeyInfoDTO.Query query) {
|
||||
query.setKeyType(KeyCategory.SYM_KEY.getCode());
|
||||
Page<KeyInfoDTO.View> page = keyInfoService.selectPageList(query);
|
||||
|
||||
return R.data(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建密钥
|
||||
|
||||
Reference in New Issue
Block a user