String str = String.valueOf(value);
支付串判断为null的方法,要加双引号 " "
String str = String.valueOf(value);
`在这里插入代码片` if (StringUtils.isNotBlank(str) && str != "null")
StringUtils.isNotBlank(str)是判断为空和为NULL的方法
在这里插入代码片
@PostMapping(value = "login.do")
@ResponseBody
public ResponseBean login(HttpSession session, @RequestParam("username") String username, @RequestParam("password") String password) {
ResponseBean response = new ResponseBean();
if (StringUtil.isEmpty(username)) throw new ParamException("账号不能为空");
if (StringUtil.isEmpty(password)) throw new ParamException("密码不能为空");
AdminToken token = new AdminToken(username, password);
Subject currentUser = SecurityUtils.getSubject();
AdminUser adminUser = adminUserService.selectByAdminUserName(username);
if (ObjectUtils.isEmpty(adminUser)) {
response.setState(501);
throw new ParamException("请输入正确的账号");
}
//查询一级菜单栏
List<ClubAdminModule> clubAdminModules = adminUserService.selectFirstModule(adminUser.getRoleId());
for(ClubAdminModule cdm:clubAdminModules){
//根据父id查询子菜单
List<ClubAdminModule> childsource=adminUserService.selectModuleItems(cdm.getId());
cdm.setChildren(childsource);
}
Map<String, Object> map=new HashMap<>();
map.put("permisition",clubAdminModules);
session.setAttribute("permisition",clubAdminModules);
session.setAttribute("name","1233646464645415");
try {
currentUser.login(token);
response.setState(200);
} catch (IncorrectCredentialsException e) {
response.setStatus(false);
response.setMsg("请输入正确的密码");
response.setState(502);
}
//id是cookie里的session ID
String id = (String) currentUser.getSession().getId();
System.out.println("111111111111111111111"+id);
//获取session id
token.setSessionId(currentUser.getSession().getId());
response.setObj(token);
return response;
}