Commit ab0cc9fe authored by chenyuxi's avatar chenyuxi

feat: 部门添加清除缓存

parent 1e74e2d5
......@@ -105,4 +105,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Param("projectNo")String projectNo);
List<String> getCspUserByDeptId(@Param("deptId")String deptId);
List<String> getCspUserByProjectNo(@Param("projectNo")String projectNo);
}
......@@ -511,8 +511,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
dept.setClient(ClientNameConstants.CLIENT_CSP);
this.save(dept);
// 清理用户权限,重新获取用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId().toString());
// 清理用户权限,重新获取项目下的用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByProjectNo(dept.getProjectNo());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
......
......@@ -448,4 +448,12 @@
where c.project_no in (SELECT project_no from sys_user_dept_permission where dept_id=#{deptId})
) and a.del_flag='0'
</select>
<select id="getCspUserByProjectNo" resultType="java.lang.String">
SELECT a.username from sys_user a
where a.user_id in (
select c.user_id from sys_user_dept_permission c
where c.project_no in (#{projectNo})
) and a.del_flag='0'
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment