密钥管理和应用接口
This commit is contained in:
@@ -1,8 +1,114 @@
|
||||
package com.sunyard.chsm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.AppQuery;
|
||||
import com.sunyard.chsm.dto.AppSave;
|
||||
import com.sunyard.chsm.dto.AppView;
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.service.ApplicationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 应用管理接口
|
||||
*
|
||||
* @author liulu
|
||||
* @since 2024/10/29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/application")
|
||||
public class ApplicationController {
|
||||
|
||||
@Resource
|
||||
private ApplicationService applicationService;
|
||||
|
||||
/**
|
||||
* 分页查询应用列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 应用列表
|
||||
*/
|
||||
@GetMapping("/pageList")
|
||||
public R<Page<AppView>> queryPageList(AppQuery query) {
|
||||
|
||||
Page<AppView> page = applicationService.selectPageList(query);
|
||||
|
||||
return R.data(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建应用
|
||||
*
|
||||
* @param save 参数
|
||||
* @return id
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(@Valid @RequestBody AppSave save) {
|
||||
Long id = applicationService.save(save);
|
||||
return R.data(String.valueOf(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用应用
|
||||
*
|
||||
* @param id 应用id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/enable")
|
||||
public R<Void> enable(Long id) {
|
||||
Assert.notNull(id, "应用id不能为空");
|
||||
applicationService.enable(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用应用
|
||||
*
|
||||
* @param id 应用id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/disable")
|
||||
public R<Void> disable(Long id) {
|
||||
Assert.notNull(id, "应用id不能为空");
|
||||
applicationService.disable(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用
|
||||
*
|
||||
* @param update 参数
|
||||
* @return 应用
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Void> update(@Valid @RequestBody AppSave update) {
|
||||
Assert.notNull(update.getId(), "应用id不能为空");
|
||||
applicationService.update(update);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用
|
||||
*
|
||||
* @param id 应用id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<Void> delete(Long id) {
|
||||
Assert.notNull(id, "应用id不能为空");
|
||||
applicationService.delete(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class KeyInfoController {
|
||||
|
||||
List<Option> options = Arrays.stream(KeyStatus.values())
|
||||
.map(it -> new Option(it.getCode(), it.getDesc()))
|
||||
.filter(it -> !KeyStatus.DESTROY.getCode().equals(it.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
return R.data(options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user