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