|
@@ -30,13 +30,13 @@ import org.springframework.cache.annotation.Cacheable;
|
|
import org.springframework.cache.annotation.Caching;
|
|
import org.springframework.cache.annotation.Caching;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author zhouhao
|
|
* @author zhouhao
|
|
*/
|
|
*/
|
|
@Service("menuService")
|
|
@Service("menuService")
|
|
-@CacheConfig(cacheNames = CacheConstants.MENU_CACHE_NAME)
|
|
|
|
public class SimpleMenuService
|
|
public class SimpleMenuService
|
|
extends AbstractTreeSortService<MenuEntity, String>
|
|
extends AbstractTreeSortService<MenuEntity, String>
|
|
implements MenuService {
|
|
implements MenuService {
|
|
@@ -59,29 +59,36 @@ public class SimpleMenuService
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Caching(
|
|
|
|
- evict = {
|
|
|
|
- @CacheEvict(allEntries = true),
|
|
|
|
- @CacheEvict(cacheNames = CacheConstants.USER_MENU_CACHE_NAME, allEntries = true)
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
|
|
+ public int updateByPk(MenuEntity entity) {
|
|
|
|
+ return super.updateByPk(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
|
|
+ public String saveOrUpdate(MenuEntity entity) {
|
|
|
|
+ return super.saveOrUpdate(entity);
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
|
|
+ public int updateBatch(Collection<MenuEntity> data) {
|
|
|
|
+ return super.updateBatch(data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
public int updateByPk(String id, MenuEntity entity) {
|
|
public int updateByPk(String id, MenuEntity entity) {
|
|
return super.updateByPk(id, entity);
|
|
return super.updateByPk(id, entity);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Caching(
|
|
|
|
- evict = {
|
|
|
|
- @CacheEvict(allEntries = true),
|
|
|
|
- @CacheEvict(cacheNames = CacheConstants.USER_MENU_CACHE_NAME, allEntries = true)
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
public int updateByPk(List<MenuEntity> data) {
|
|
public int updateByPk(List<MenuEntity> data) {
|
|
return super.updateByPk(data);
|
|
return super.updateByPk(data);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @CacheEvict(allEntries = true)
|
|
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
public String insert(MenuEntity entity) {
|
|
public String insert(MenuEntity entity) {
|
|
if (entity.getStatus() == null) {
|
|
if (entity.getStatus() == null) {
|
|
entity.setStatus((byte) 1);
|
|
entity.setStatus((byte) 1);
|
|
@@ -90,30 +97,25 @@ public class SimpleMenuService
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Cacheable(key = "'ids:'+(#id==null?'0':#id.hashCode())")
|
|
|
|
|
|
+ @Cacheable(cacheNames =CacheConstants.MENU_CACHE_NAME,key = "'ids:'+(#id==null?'0':#id.hashCode())")
|
|
public List<MenuEntity> selectByPk(List<String> id) {
|
|
public List<MenuEntity> selectByPk(List<String> id) {
|
|
return super.selectByPk(id);
|
|
return super.selectByPk(id);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Caching(
|
|
|
|
- evict = {
|
|
|
|
- @CacheEvict(allEntries = true),
|
|
|
|
- @CacheEvict(cacheNames = CacheConstants.USER_MENU_CACHE_NAME, allEntries = true)
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
|
|
+ @CacheEvict(cacheNames ={CacheConstants.MENU_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
|
|
public int deleteByPk(String id) {
|
|
public int deleteByPk(String id) {
|
|
return super.deleteByPk(id);
|
|
return super.deleteByPk(id);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Cacheable(key = "'permission-ids:'+(#permissionId==null?'0':#permissionId.hashCode())")
|
|
|
|
|
|
+ @Cacheable(cacheNames =CacheConstants.MENU_CACHE_NAME,key = "'permission-ids:'+(#permissionId==null?'0':#permissionId.hashCode())")
|
|
public List<MenuEntity> getByPermissionId(List<String> permissionId) {
|
|
public List<MenuEntity> getByPermissionId(List<String> permissionId) {
|
|
return createQuery().noPaging().where().in("permissionId", permissionId).list();
|
|
return createQuery().noPaging().where().in("permissionId", permissionId).list();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Cacheable(key = "'permission-id:'+#permissionId")
|
|
|
|
|
|
+ @Cacheable(cacheNames =CacheConstants.MENU_CACHE_NAME,key = "'permission-id:'+#permissionId")
|
|
public MenuEntity getByPermissionId(String permissionId) {
|
|
public MenuEntity getByPermissionId(String permissionId) {
|
|
return createQuery().noPaging().where().is("permissionId", permissionId).single();
|
|
return createQuery().noPaging().where().is("permissionId", permissionId).single();
|
|
}
|
|
}
|