diff --git a/chsm-common/src/main/java/com/sunyard/chsm/enums/KeyStatus.java b/chsm-common/src/main/java/com/sunyard/chsm/enums/KeyStatus.java index 1c43204..9ba5a99 100644 --- a/chsm-common/src/main/java/com/sunyard/chsm/enums/KeyStatus.java +++ b/chsm-common/src/main/java/com/sunyard/chsm/enums/KeyStatus.java @@ -19,7 +19,7 @@ public enum KeyStatus { DISABLED("disabled", "已停用"), ARCHIVED("archived", "已归档"), EXPIRED("expired", "已过期"), - DESTORY("destory", "已销毁"), + DESTROY("destroy", "已销毁"), ; private final String code; private final String desc; diff --git a/chsm-common/src/main/java/com/sunyard/chsm/model/Option.java b/chsm-common/src/main/java/com/sunyard/chsm/model/Option.java index 167f180..7c1de4e 100644 --- a/chsm-common/src/main/java/com/sunyard/chsm/model/Option.java +++ b/chsm-common/src/main/java/com/sunyard/chsm/model/Option.java @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class Option { - public String code; + private String code; private String text; diff --git a/chsm-common/src/main/java/com/sunyard/chsm/model/entity/KeyInfo.java b/chsm-common/src/main/java/com/sunyard/chsm/model/entity/KeyInfo.java index 2a9ba57..5186170 100644 --- a/chsm-common/src/main/java/com/sunyard/chsm/model/entity/KeyInfo.java +++ b/chsm-common/src/main/java/com/sunyard/chsm/model/entity/KeyInfo.java @@ -30,8 +30,10 @@ public class KeyInfo { private LocalDateTime expiredTime; private String remark; + private Boolean deleted; private LocalDateTime createTime; private LocalDateTime updateTime; + private LocalDateTime deleteTime; @TableField(exist = false) private List records; diff --git a/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/ApplicationController.java b/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/ApplicationController.java index 22fc89e..a6d8019 100644 --- a/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/ApplicationController.java +++ b/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/ApplicationController.java @@ -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> queryPageList(AppQuery query) { + + Page page = applicationService.selectPageList(query); + + return R.data(page); + } + + /** + * 创建应用 + * + * @param save 参数 + * @return id + */ + @PostMapping + public R save(@Valid @RequestBody AppSave save) { + Long id = applicationService.save(save); + return R.data(String.valueOf(id)); + } + + /** + * 启用应用 + * + * @param id 应用id + * @return + */ + @PostMapping("/enable") + public R enable(Long id) { + Assert.notNull(id, "应用id不能为空"); + applicationService.enable(id); + return R.ok(); + } + + /** + * 停用应用 + * + * @param id 应用id + * @return + */ + @PostMapping("/disable") + public R disable(Long id) { + Assert.notNull(id, "应用id不能为空"); + applicationService.disable(id); + return R.ok(); + } + + /** + * 修改应用 + * + * @param update 参数 + * @return 应用 + */ + @PutMapping + public R update(@Valid @RequestBody AppSave update) { + Assert.notNull(update.getId(), "应用id不能为空"); + applicationService.update(update); + return R.ok(); + } + + /** + * 删除应用 + * + * @param id 应用id + * @return + */ + @DeleteMapping + public R delete(Long id) { + Assert.notNull(id, "应用id不能为空"); + applicationService.delete(id); + return R.ok(); + } + } diff --git a/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/KeyInfoController.java b/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/KeyInfoController.java index 331dbe5..2d4c773 100644 --- a/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/KeyInfoController.java +++ b/chsm-web-manage/src/main/java/com/sunyard/chsm/controller/KeyInfoController.java @@ -41,6 +41,7 @@ public class KeyInfoController { List