From: Tang Cheng Date: Tue, 28 May 2019 02:16:40 +0000 (+0800) Subject: 修改sourcetype定义 X-Git-Tag: 1.0.0^2~188 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=695667938a55f89e8fef45c8bd50550c23e45782;p=epayment%2Ffood_payapi.git 修改sourcetype定义 --- diff --git a/build.gradle b/build.gradle index d9303c58..b11247b4 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ dependencies { // implementation 'org.springframework.security.oauth:spring-security-oauth2' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.session:spring-session-data-redis' + implementation 'org.springframework.boot:spring-boot-starter-cache' implementation 'org.springframework.social:spring-social-web:1.1.6.RELEASE' implementation 'org.jetbrains.kotlin:kotlin-reflect' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' diff --git a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java index 036007de..86a98418 100644 --- a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java +++ b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java @@ -1,6 +1,7 @@ package com.supwisdom.dlpay.api.service; import com.supwisdom.dlpay.api.domain.TSourceType; +import org.springframework.cache.annotation.Cacheable; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -11,10 +12,10 @@ import java.util.Map; */ public interface SourceTypeService { - @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class,readOnly = true) - TSourceType getByPaytype(String paytype); + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true) + TSourceType getByPaytype(String paytype); - @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class,readOnly = true) - Map getPaytypeConfigByPaytype(String pattype); + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true) + Map getPaytypeConfigByPaytype(String pattype); } diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java index 247342c3..60cf1a57 100644 --- a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java +++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java @@ -6,6 +6,8 @@ import com.supwisdom.dlpay.api.domain.TSourceType; import com.supwisdom.dlpay.api.domain.TPaytypeConfig; import com.supwisdom.dlpay.api.service.SourceTypeService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -16,6 +18,7 @@ import java.util.Map; * Created by shuwei on 2019/4/9. */ @Service +@CacheConfig(cacheNames = "sourcetypeCache") public class SourceTypeServiceImpl implements SourceTypeService { @Autowired private SourceTypeDao paytypeDao; @@ -23,11 +26,13 @@ public class SourceTypeServiceImpl implements SourceTypeService { private PaytypeConfigDao paytypeConfigDao; @Override + @Cacheable public TSourceType getByPaytype(String paytype) { return paytypeDao.getOne(paytype); } @Override + @Cacheable public Map getPaytypeConfigByPaytype(String pattype) { List list = paytypeConfigDao.getByPaytype(pattype); Map map = new HashMap<>(list.size());