AccountService.java 585 B

123456789101112131415161718192021222324252627
  1. package yike.example.service;
  2. import javax.annotation.Resource;
  3. import org.springframework.cache.annotation.Cacheable;
  4. import org.springframework.stereotype.Service;
  5. import yike.example.dao.AccountDao;
  6. import yike.example.obj.Account;
  7. @Service
  8. public class AccountService {
  9. @Resource
  10. private AccountDao accountDao;
  11. @Cacheable(value="account", key="'aco_' + #id", condition = "#id != null")
  12. public Account getById(Long id) {
  13. return accountDao.selectByPrimaryKey(id);
  14. }
  15. public void updateAccountInfo(Account account) {
  16. //
  17. accountDao.updateAccountInfo(account);
  18. }
  19. }