123456789101112131415161718192021222324252627 |
- package yike.example.service;
- import javax.annotation.Resource;
- import org.springframework.cache.annotation.Cacheable;
- import org.springframework.stereotype.Service;
- import yike.example.dao.AccountDao;
- import yike.example.obj.Account;
- @Service
- public class AccountService {
- @Resource
- private AccountDao accountDao;
-
- @Cacheable(value="account", key="'aco_' + #id", condition = "#id != null")
- public Account getById(Long id) {
- return accountDao.selectByPrimaryKey(id);
- }
-
- public void updateAccountInfo(Account account) {
- //
- accountDao.updateAccountInfo(account);
- }
- }
|