diff --git a/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java b/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java index bf69a677..07f5abcf 100644 --- a/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java +++ b/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java @@ -16,12 +16,16 @@ import com.ibeetl.admin.core.util.PlatformException; import org.apache.commons.collections4.CollectionUtils; import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; + +import static com.ibeetl.admin.core.service.CorePlatformService.USER_FUNCTION_TREE_CACHE; + /** * @author TLT * @@ -120,6 +124,7 @@ public class FunctionConsoleService extends CoreBaseService { * @param userId * @return */ + @Cacheable(value=USER_FUNCTION_TREE_CACHE, key="userId") public String getFunctionIdByUser(Long userId){ return this.roleFunctionConsoleDao.getFunctionIdByUser(userId); } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java b/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java index eadfb955..ed5e204d 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java @@ -1,9 +1,5 @@ package com.ibeetl.admin.core.conf; -import java.io.UnsupportedEncodingException; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; - import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cache.Cache; @@ -23,6 +19,10 @@ import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; import org.springframework.data.redis.serializer.RedisSerializationContext.SerializationPair; +import java.io.UnsupportedEncodingException; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; + /** * 支持一二级缓存,使得性能逆天快.默认不开启 * @@ -30,8 +30,8 @@ import org.springframework.data.redis.serializer.RedisSerializationContext.Seria * */ -//@Configuration -//@ConditionalOnProperty(name="springext.cache.enabled", havingValue="true" ,matchIfMissing=false) +@Configuration +@ConditionalOnProperty(name="springext.cache.enabled", havingValue="true" ,matchIfMissing=false) public class CacheConfig { // 定义一个redis 的频道,默认叫cache,用于pub/sub diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java index dc5df4ce..631c2837 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java @@ -42,7 +42,7 @@ public class CoreDictService extends CoreBaseService { * @param type 字典类型, * @return List */ - @Cacheable(value = CorePlatformService.DICT_CACHE_TYPE) + @Cacheable(value = CorePlatformService.DICT_CACHE_TYPE, unless="#result == null || #result.size() == 0") public List findAllByType(String type) { return dictDao.findAllList(type); } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java index 7a62bc05..ba4ecd1f 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java @@ -41,6 +41,7 @@ public class CorePlatformService { public static final String MENU_TREE_CACHE = "cache:core:menuTree"; public static final String ORG_TREE_CACHE = "cache:core:orgTree"; public static final String FUNCTION_TREE_CACHE = "cache:core:functionTree"; + public static final String USER_FUNCTION_TREE_CACHE = "cache:core:userFunction"; //字典列表 public static final String DICT_CACHE_TYPE = "cache:core:dictType"; public static final String DICT_CACHE_VALUE = "cache:core:dictValue"; @@ -173,10 +174,6 @@ public class CorePlatformService { } public MenuItem getMenuItem(long userId, long orgId) { - System.out.println(userId); -// System.out.println(coreUserDao); -// CoreUserDao coreUserDao1 = SpringUtil.getBean("coreUserDao"); -// System.out.println(coreUserDao1); CoreUser user = coreUserDao.unique(userId); if (this.isSupperAdmin(user)) { return self.buildMenu(); diff --git a/web/src/main/resources/application-dev.properties b/web/src/main/resources/application-dev.properties index 798251e4..b42bd818 100644 --- a/web/src/main/resources/application-dev.properties +++ b/web/src/main/resources/application-dev.properties @@ -1,6 +1,9 @@ #\u73AF\u5883\u6807\u8BC6 admin.isOnline=false +# \u9006\u5929\u7F13\u5B58\u5F00\u542F +springext.cache.enabled=true + logging.level.root=INFO #logging.level.root=DEBUG logging.level.org.springframework.web=DEBUG diff --git a/web/src/main/resources/application-local.properties b/web/src/main/resources/application-local.properties index 9bb68601..68eac683 100644 --- a/web/src/main/resources/application-local.properties +++ b/web/src/main/resources/application-local.properties @@ -1,6 +1,9 @@ #\u73AF\u5883\u6807\u8BC6 admin.isOnline=false +# \u9006\u5929\u7F13\u5B58\u5F00\u542F +springext.cache.enabled=true + logging.level.root=INFO #logging.level.root=DEBUG logging.level.org.springframework.web=DEBUG diff --git a/web/src/main/resources/application-prod.properties b/web/src/main/resources/application-prod.properties index 763694c8..821e306f 100644 --- a/web/src/main/resources/application-prod.properties +++ b/web/src/main/resources/application-prod.properties @@ -1,6 +1,9 @@ #\u73AF\u5883\u6807\u8BC6 admin.isOnline=true +# \u9006\u5929\u7F13\u5B58\u5F00\u542F +springext.cache.enabled=true + logging.level.root=ERROR #logging.level.root=DEBUG logging.level.org.springframework.web=DEBUG diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourse.md b/web/src/main/resources/sql/jlw/teacherOpenCourse.md index 83f7eff5..62f58a43 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourse.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourse.md @@ -63,7 +63,7 @@ queryByCondition @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @} - order by ta.teacher_merge_application_order_index desc + order by ta.teacher_open_course_merge_teacher_order_index desc queryByConditionQuery @@ -129,7 +129,7 @@ queryByConditionQuery @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @} - order by ta.teacher_merge_application_order_index desc + order by ta.teacher_open_course_merge_teacher_order_index desc deleteTeacherOpenCourseByIds ===