修改sourcetype定义
diff --git a/build.gradle b/build.gradle
index d9303c5..b11247b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,6 +34,7 @@
// 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 036007d..86a9841 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 @@
*/
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<String,String> getPaytypeConfigByPaytype(String pattype);
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+ Map<String, String> 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 247342c..60cf1a5 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.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 @@
* Created by shuwei on 2019/4/9.
*/
@Service
+@CacheConfig(cacheNames = "sourcetypeCache")
public class SourceTypeServiceImpl implements SourceTypeService {
@Autowired
private SourceTypeDao paytypeDao;
@@ -23,11 +26,13 @@
private PaytypeConfigDao paytypeConfigDao;
@Override
+ @Cacheable
public TSourceType getByPaytype(String paytype) {
return paytypeDao.getOne(paytype);
}
@Override
+ @Cacheable
public Map<String, String> getPaytypeConfigByPaytype(String pattype) {
List<TPaytypeConfig> list = paytypeConfigDao.getByPaytype(pattype);
Map<String, String> map = new HashMap<>(list.size());