package org.hswebframework.web.service.template.simple;

import org.hswebframework.web.dao.template.TemplateDao;
import org.hswebframework.web.entity.template.TemplateEntity;
import org.hswebframework.web.service.GenericEntityService;
import org.hswebframework.web.id.IDGenerator;
import org.hswebframework.web.service.template.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 默认的服务实现
 *
 * @author hsweb-generator-online
 */
@Service("templateService")
public class SimpleTemplateService extends GenericEntityService<TemplateEntity, String>
        implements TemplateService {
    @Autowired
    private TemplateDao templateDao;

    @Override
    protected IDGenerator<String> getIDGenerator() {
        return IDGenerator.MD5;
    }

    @Override
    public TemplateDao getDao() {
        return templateDao;
    }

    @Override
    public int updateByPk(String id, TemplateEntity entity) {
        TemplateEntity old = selectByPk(id);
        assertNotNull(old);
        entity.setVersion(old.getVersion() + 1);
        return super.updateByPk(id, entity);
    }
}

@@ -168,16 +168,87 @@
 Entity;%0A
+import org.hswebframework.web.service.EnableCacheGenericEntityService;%0A
 import o
@@ -291,32 +291,32 @@
 cEntityService;%0A
-
 import org.hsweb
@@ -472,16 +472,73 @@
 owired;%0A
+import org.springframework.cache.annotation.CacheConfig;%0A
 import o
@@ -661,16 +661,54 @@
 rvice%22)%0A
+@CacheConfig(cacheNames = %22template%22)%0A
 public c
@@ -742,16 +742,27 @@
 extends 
+EnableCache
 GenericE

add cache config