|
|
@@ -1,6 +1,8 @@
|
|
1
|
1
|
package api.service.system.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import api.entity.view.system.UserView;
|
|
|
4
|
+import api.util.helper.RedisHelper;
|
|
|
5
|
+import api.util.helper.SpringHelper;
|
|
4
|
6
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
5
|
7
|
import api.entity.database.system.User;
|
|
6
|
8
|
import api.entity.database.system.UserRole;
|
|
|
@@ -305,6 +307,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
305
|
307
|
@Override
|
|
306
|
308
|
@Transactional
|
|
307
|
309
|
public void insertUserAuth(Long userId, Long[] roleIds) {
|
|
|
310
|
+ removeCache("UserRole");
|
|
308
|
311
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
|
309
|
312
|
insertUserRole(userId, roleIds);
|
|
310
|
313
|
}
|
|
|
@@ -328,4 +331,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
328
|
331
|
userRoleMapper.batchUserRole(list);
|
|
329
|
332
|
}
|
|
330
|
333
|
}
|
|
|
334
|
+ private boolean removeCache( String clsName) {
|
|
|
335
|
+ RedisHelper redisHelper = SpringHelper.getBean(RedisHelper.class);
|
|
|
336
|
+ if (redisHelper.hasKey("database:"+clsName)) {
|
|
|
337
|
+ return redisHelper.deleteCache("database:"+clsName);
|
|
|
338
|
+ }
|
|
|
339
|
+ return true;
|
|
|
340
|
+ }
|
|
331
|
341
|
}
|