Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
4de73800
Commit
4de73800
authored
Oct 21, 2017
by
stylefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复缓存失效的问题
parent
fbbe297b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+7
-0
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
+0
-7
No files found.
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
4de73800
...
@@ -2,6 +2,8 @@ package com.stylefeng.guns.common.constant.factory;
...
@@ -2,6 +2,8 @@ package com.stylefeng.guns.common.constant.factory;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.stylefeng.guns.common.constant.cache.Cache
;
import
com.stylefeng.guns.common.constant.cache.CacheKey
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.common.constant.state.MenuStatus
;
import
com.stylefeng.guns.common.constant.state.MenuStatus
;
import
com.stylefeng.guns.common.persistence.dao.*
;
import
com.stylefeng.guns.common.persistence.dao.*
;
...
@@ -11,6 +13,7 @@ import com.stylefeng.guns.core.support.StrKit;
...
@@ -11,6 +13,7 @@ import com.stylefeng.guns.core.support.StrKit;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.SpringContextHolder
;
import
com.stylefeng.guns.core.util.SpringContextHolder
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -74,6 +77,7 @@ public class ConstantFactory implements IConstantFactory {
...
@@ -74,6 +77,7 @@ public class ConstantFactory implements IConstantFactory {
* 通过角色ids获取角色名称
* 通过角色ids获取角色名称
*/
*/
@Override
@Override
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
ROLES_NAME
+
"'+#roleIds"
)
public
String
getRoleName
(
String
roleIds
)
{
public
String
getRoleName
(
String
roleIds
)
{
Integer
[]
roles
=
Convert
.
toIntArray
(
roleIds
);
Integer
[]
roles
=
Convert
.
toIntArray
(
roleIds
);
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
...
@@ -90,6 +94,7 @@ public class ConstantFactory implements IConstantFactory {
...
@@ -90,6 +94,7 @@ public class ConstantFactory implements IConstantFactory {
* 通过角色id获取角色名称
* 通过角色id获取角色名称
*/
*/
@Override
@Override
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
SINGLE_ROLE_NAME
+
"'+#roleId"
)
public
String
getSingleRoleName
(
Integer
roleId
)
{
public
String
getSingleRoleName
(
Integer
roleId
)
{
if
(
0
==
roleId
)
{
if
(
0
==
roleId
)
{
return
"--"
;
return
"--"
;
...
@@ -105,6 +110,7 @@ public class ConstantFactory implements IConstantFactory {
...
@@ -105,6 +110,7 @@ public class ConstantFactory implements IConstantFactory {
* 通过角色id获取角色英文名称
* 通过角色id获取角色英文名称
*/
*/
@Override
@Override
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
SINGLE_ROLE_TIP
+
"'+#roleId"
)
public
String
getSingleRoleTip
(
Integer
roleId
)
{
public
String
getSingleRoleTip
(
Integer
roleId
)
{
if
(
0
==
roleId
)
{
if
(
0
==
roleId
)
{
return
"--"
;
return
"--"
;
...
@@ -120,6 +126,7 @@ public class ConstantFactory implements IConstantFactory {
...
@@ -120,6 +126,7 @@ public class ConstantFactory implements IConstantFactory {
* 获取部门名称
* 获取部门名称
*/
*/
@Override
@Override
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
DEPT_NAME
+
"'+#deptId"
)
public
String
getDeptName
(
Integer
deptId
)
{
public
String
getDeptName
(
Integer
deptId
)
{
Dept
dept
=
deptMapper
.
selectById
(
deptId
);
Dept
dept
=
deptMapper
.
selectById
(
deptId
);
if
(
ToolUtil
.
isNotEmpty
(
dept
)
&&
ToolUtil
.
isNotEmpty
(
dept
.
getFullname
()))
{
if
(
ToolUtil
.
isNotEmpty
(
dept
)
&&
ToolUtil
.
isNotEmpty
(
dept
.
getFullname
()))
{
...
...
guns-admin/src/main/java/com/stylefeng/guns/common/constant/factory/IConstantFactory.java
View file @
4de73800
package
com
.
stylefeng
.
guns
.
common
.
constant
.
factory
;
package
com
.
stylefeng
.
guns
.
common
.
constant
.
factory
;
import
com.stylefeng.guns.common.constant.cache.Cache
;
import
com.stylefeng.guns.common.constant.cache.CacheKey
;
import
com.stylefeng.guns.common.persistence.model.Dict
;
import
com.stylefeng.guns.common.persistence.model.Dict
;
import
org.springframework.cache.annotation.Cacheable
;
import
java.util.List
;
import
java.util.List
;
...
@@ -34,25 +31,21 @@ public interface IConstantFactory {
...
@@ -34,25 +31,21 @@ public interface IConstantFactory {
/**
/**
* 通过角色ids获取角色名称
* 通过角色ids获取角色名称
*/
*/
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
ROLES_NAME
+
"'+#roleIds"
)
String
getRoleName
(
String
roleIds
);
String
getRoleName
(
String
roleIds
);
/**
/**
* 通过角色id获取角色名称
* 通过角色id获取角色名称
*/
*/
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
SINGLE_ROLE_NAME
+
"'+#roleId"
)
String
getSingleRoleName
(
Integer
roleId
);
String
getSingleRoleName
(
Integer
roleId
);
/**
/**
* 通过角色id获取角色英文名称
* 通过角色id获取角色英文名称
*/
*/
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
SINGLE_ROLE_TIP
+
"'+#roleId"
)
String
getSingleRoleTip
(
Integer
roleId
);
String
getSingleRoleTip
(
Integer
roleId
);
/**
/**
* 获取部门名称
* 获取部门名称
*/
*/
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
DEPT_NAME
+
"'+#deptId"
)
String
getDeptName
(
Integer
deptId
);
String
getDeptName
(
Integer
deptId
);
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment