From 66e34aba51e26cc8c94ef78c4090090790adfcbc Mon Sep 17 00:00:00 2001 From: xioayue Date: Wed, 29 Jun 2022 23:48:16 +0800 Subject: [PATCH] =?UTF-8?q?cert=20=E6=9C=8D=E5=8A=A1=E5=B1=82=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/chjyj/szwh/service/CertService.java | 22 +++++++++++++ .../szwh/service/impl/CertServiceImpl.java | 23 ++++++++++++++ .../cn/chjyj/szwh/mapper/CertMapperTest.java | 31 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/main/java/cn/chjyj/szwh/service/CertService.java create mode 100644 src/main/java/cn/chjyj/szwh/service/impl/CertServiceImpl.java create mode 100644 src/test/java/cn/chjyj/szwh/mapper/CertMapperTest.java diff --git a/src/main/java/cn/chjyj/szwh/service/CertService.java b/src/main/java/cn/chjyj/szwh/service/CertService.java new file mode 100644 index 0000000..3e15ebb --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/service/CertService.java @@ -0,0 +1,22 @@ +package cn.chjyj.szwh.service; + +import cn.chjyj.szwh.bean.Cert; + +/** + * 证书配置信息 + */ +public interface CertService { + /** + * 根据编号查询 + * @param id + * @return + */ + Cert getCertByid(Integer id); + + /** + * 根据类型查询 + * @param stype + * @return + */ + Cert getCertByType(String stype); +} diff --git a/src/main/java/cn/chjyj/szwh/service/impl/CertServiceImpl.java b/src/main/java/cn/chjyj/szwh/service/impl/CertServiceImpl.java new file mode 100644 index 0000000..67dba99 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/service/impl/CertServiceImpl.java @@ -0,0 +1,23 @@ +package cn.chjyj.szwh.service.impl; + +import cn.chjyj.szwh.bean.Cert; +import cn.chjyj.szwh.mapper.CertMapper; +import cn.chjyj.szwh.service.CertService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CertServiceImpl implements CertService { + @Autowired + private CertMapper certMapper; + + @Override + public Cert getCertByid(Integer id) { + return certMapper.getCertByid(id); + } + + @Override + public Cert getCertByType(String stype) { + return certMapper.getCertByType(stype); + } +} diff --git a/src/test/java/cn/chjyj/szwh/mapper/CertMapperTest.java b/src/test/java/cn/chjyj/szwh/mapper/CertMapperTest.java new file mode 100644 index 0000000..0b6c637 --- /dev/null +++ b/src/test/java/cn/chjyj/szwh/mapper/CertMapperTest.java @@ -0,0 +1,31 @@ +package cn.chjyj.szwh.mapper; + +import cn.chjyj.szwh.bean.Cert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.*; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class CertMapperTest { + @Autowired + private CertMapper certMapper; + + @Test + public void getCertByid() { + int id =1; + Cert cert = certMapper.getCertByid(id); + System.out.println(cert.getToken()); + } + + @Test + public void getCertByType() { + String stype ="entrust"; + Cert cert = certMapper.getCertByType(stype); + System.out.println(cert.getToken()); + } +} \ No newline at end of file