3 changed files with 76 additions and 0 deletions
@ -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); |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
@ -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()); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue