| 12345678910111213141516171819202122232425262728293031 |
- 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<HtmlFragmentMapper> {
- @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;
- }
- }
|