boweniac hace 6 días
padre
commit
929317170f

+ 13 - 1
src/main/java/com/jubotech/business/web/service/AccountService.java

@@ -5,8 +5,11 @@ import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.jubotech.framework.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
 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 org.springframework.transaction.annotation.Transactional;
 
@@ -22,6 +25,7 @@ import tk.mybatis.mapper.entity.Example;
 
 @Service
 @Transactional // 支持事务
+@CacheConfig(cacheNames="system")
 public class AccountService {
 
 	@Autowired
@@ -77,7 +81,15 @@ public class AccountService {
 		AccountInfo user = accountDao.findAccountInfoByAccount(account);
 		return user;
 	}
-	 
+
+	@Cacheable(key="#accountIds")
+	public List<AccountInfo> queryByIds(String accountIds) {
+		Example example = new Example(AccountInfo.class);
+		Example.Criteria criteria = example.createCriteria();
+		criteria.andIn("id", StringUtil.stringToList(accountIds));
+		return accountDao.selectByExample(example);
+	}
+
 	public List<AccountInfo> getAllAccountInfoByCid(Integer cid){
 		return accountDao.getAllAccountInfoByCid(cid);
 	}