package com.goafanti.fragment.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.goafanti.common.dao.HtmlFragmentMapper; import com.goafanti.common.model.HtmlFragment; import com.goafanti.core.mybatis.BaseMybatisDao; @Service @Transactional public class FragmentService extends BaseMybatisDao { @Autowired HtmlFragmentMapper htmlFragmentMapper; @Cacheable(value = "HtmlFragmentCache", key = "'HtmlFragment:'+#id") public HtmlFragment selectById(String id) { return htmlFragmentMapper.selectByPrimaryKey(id); } @CachePut(value = "HtmlFragmentCache", key = "'HtmlFragment:'+#id") public HtmlFragment save(String id, HtmlFragment record) { htmlFragmentMapper.insert(record); return record; } }