证书管理

This commit is contained in:
liulu
2024-11-08 10:42:14 +08:00
parent fdcc750eee
commit e4af8ecbf4
10 changed files with 221 additions and 66 deletions
@@ -0,0 +1,32 @@
package com.sunyard.chsm.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunyard.chsm.model.entity.AppCert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* @author liulu
* @since 2024/11/6
*/
@Mapper
public interface AppCertMapper extends BaseMapper<AppCert> {
default AppCert selectBySN(String sn) {
Assert.hasText(sn, "证书序列号不能为空");
List<AppCert> certs = selectList(new LambdaQueryWrapper<AppCert>()
.eq(AppCert::getSerialNumber, sn)
);
if (CollectionUtils.isEmpty(certs)) {
return null;
}
return certs.iterator().next();
}
}