密钥管理

This commit is contained in:
liulu 2024-11-01 15:11:47 +08:00
parent 6d6f3f1d6b
commit b5df4c2406
2 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,6 @@
package com.sunyard.chsm.model.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -31,7 +30,7 @@ public class KeyInfo {
private LocalDateTime expiredTime;
private String remark;
@TableLogic
// @TableLogic
private Boolean deleted;
private LocalDateTime createTime;
private LocalDateTime updateTime;

View File

@ -514,12 +514,16 @@ public class KeyInfoServiceImpl implements KeyInfoService {
.collect(Collectors.toList());
Assert.isTrue(CollectionUtils.isEmpty(unNormalCodes),
"密钥id: " + String.join(",", unNormalCodes) + "当前状态不支持销毁操作");
keyInfoMapper.update(
new LambdaUpdateWrapper<KeyInfo>()
.set(KeyInfo::getStatus, KeyStatus.DESTROY.getCode())
.set(KeyInfo::getDeleted, true)
.set(KeyInfo::getDeleteTime, now)
.in(KeyInfo::getId, ids)
);
keyInfoMapper.deleteBatchIds(ids);
spKeyRecordMapper.delete(new LambdaUpdateWrapper<KeyRecord>().in(KeyRecord::getKeyId, ids));
// keyInfoMapper.update(
// new LambdaUpdateWrapper<KeyInfo>()
// .set(KeyInfo::getStatus, KeyStatus.DESTROY.getCode())
// .set(KeyInfo::getDeleted, true)
// .set(KeyInfo::getDeleteTime, now)
// .in(KeyInfo::getId, ids)
// );
}
}