// 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'
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;
*/
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);
}
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;
* Created by shuwei on 2019/4/9.
*/
@Service
+@CacheConfig(cacheNames = "sourcetypeCache")
public class SourceTypeServiceImpl implements SourceTypeService {
@Autowired
private SourceTypeDao paytypeDao;
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());