登录superadmin用户操作的时候会出现偶发的sys_role数据表清空动作,检查了一下代码也没找到问题在哪,有点懵逼
9 回复
把 SysRoleServiceImpl 里 @Async 异步注解删除看看
@At("/enable/?")
@Ok("json")
@RequiresPermissions("sys.manager.user.edit")
@SLog(tag = "启用用户", msg = "用户名:${args[1].getAttribute('loginname')}")
public Object enable(String userId, HttpServletRequest req) {
try {
req.setAttribute("loginname", sysUserService.fetch(userId).getLoginname());
sysUserService.update(Chain.make("disabled", false), Cnd.where("id", "=", userId));
sysUserService.clear();
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
@At("/disable/?")
@Ok("json")
@RequiresPermissions("sys.manager.user.edit")
@SLog(tag = "禁用用户", msg = "用户名:${args[1].getAttribute('loginname')}")
public Object disable(String userId, HttpServletRequest req) {
try {
String loginname = sysUserService.fetch(userId).getLoginname();
if ("superadmin".equals(loginname)) {
return Result.error("system.not.allow");
}
req.setAttribute("loginname", loginname);
sysUserService.update(Chain.make("disabled", true), Cnd.where("id", "=", userId));
sysUserService.clear();
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
https://github.com/Wizzercn/NutzWk/blob/v5.x/wk-app/wk-nb-web-vue/src/main/java/cn/wizzer/app/web/modules/controllers/platform/sys/SysUserController.java
问题找到了
启用禁用都调用了clear方法,所以user表没有了
添加回复
请先登陆